浏览代码

completed part 1: 17 tests

Tommy Rogers 6 年前
父节点
当前提交
59c473a4dc

+ 1
- 0
.idea/.name 查看文件

@@ -0,0 +1 @@
1
+generics

+ 16
- 0
.idea/compiler.xml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="generics" />
10
+      </profile>
11
+    </annotationProcessing>
12
+    <bytecodeTargetLevel>
13
+      <module name="generics" target="1.7" />
14
+    </bytecodeTargetLevel>
15
+  </component>
16
+</project>

+ 13
- 0
.idea/libraries/Maven__junit_junit_4_12.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: junit:junit:4.12">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml 查看文件

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: org.hamcrest:hamcrest-core:1.3">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
.idea/misc.xml 查看文件

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="MavenProjectsManager">
4
+    <option name="originalFiles">
5
+      <list>
6
+        <option value="$PROJECT_DIR$/pom.xml" />
7
+      </list>
8
+    </option>
9
+  </component>
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
13
+</project>

+ 8
- 0
.idea/modules.xml 查看文件

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/generics.iml" filepath="$PROJECT_DIR$/generics.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 569
- 0
.idea/workspace.xml 查看文件

@@ -0,0 +1,569 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="2dafbc5a-5a43-4fb4-9442-bf3c9d9a408a" name="Default" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
10
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
11
+      <change afterPath="$PROJECT_DIR$/generics.iml" afterDir="false" />
12
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
13
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
14
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
15
+      <change afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
16
+    </list>
17
+    <ignored path="$PROJECT_DIR$/target/" />
18
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
19
+    <option name="TRACKING_ENABLED" value="true" />
20
+    <option name="SHOW_DIALOG" value="false" />
21
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
22
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
23
+    <option name="LAST_RESOLUTION" value="IGNORE" />
24
+  </component>
25
+  <component name="FileEditorManager">
26
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
27
+      <file leaf-file-name="MyArrayListTest.java" pinned="false" current-in-tab="true">
28
+        <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
29
+          <provider selected="true" editor-type-id="text-editor">
30
+            <state relative-caret-position="276">
31
+              <caret line="173" selection-start-line="173" selection-end-line="173" />
32
+              <folding>
33
+                <element signature="imports" expanded="true" />
34
+              </folding>
35
+            </state>
36
+          </provider>
37
+        </entry>
38
+      </file>
39
+      <file leaf-file-name="MyArrayList.java" pinned="false" current-in-tab="false">
40
+        <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
41
+          <provider selected="true" editor-type-id="text-editor">
42
+            <state relative-caret-position="228">
43
+              <caret line="81" column="34" lean-forward="true" selection-start-line="81" selection-start-column="34" selection-end-line="81" selection-end-column="34" />
44
+              <folding>
45
+                <element signature="imports" expanded="true" />
46
+                <element signature="e#131#132#0" expanded="true" />
47
+                <element signature="e#179#180#0" expanded="true" />
48
+                <element signature="e#142#143#0" expanded="true" />
49
+                <element signature="e#176#177#0" expanded="true" />
50
+                <element signature="e#1004#1005#0" expanded="true" />
51
+                <element signature="e#1041#1042#0" expanded="true" />
52
+                <element signature="e#1728#1729#0" expanded="true" />
53
+                <element signature="e#1757#1758#0" expanded="true" />
54
+              </folding>
55
+            </state>
56
+          </provider>
57
+        </entry>
58
+      </file>
59
+      <file leaf-file-name="ArrayList.java" pinned="false" current-in-tab="false">
60
+        <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
61
+          <provider selected="true" editor-type-id="text-editor">
62
+            <state relative-caret-position="269">
63
+              <caret line="319" column="12" lean-forward="true" selection-start-line="319" selection-start-column="12" selection-end-line="320" selection-end-column="45" />
64
+            </state>
65
+          </provider>
66
+        </entry>
67
+      </file>
68
+      <file leaf-file-name="System.java" pinned="false" current-in-tab="false">
69
+        <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/src.zip!/java/lang/System.java">
70
+          <provider selected="true" editor-type-id="text-editor">
71
+            <state relative-caret-position="-6382">
72
+              <caret line="58" column="19" selection-start-line="58" selection-start-column="19" selection-end-line="58" selection-end-column="19" />
73
+            </state>
74
+          </provider>
75
+        </entry>
76
+      </file>
77
+    </leaf>
78
+  </component>
79
+  <component name="FileTemplateManagerImpl">
80
+    <option name="RECENT_TEMPLATES">
81
+      <list>
82
+        <option value="Class" />
83
+      </list>
84
+    </option>
85
+  </component>
86
+  <component name="Git.Settings">
87
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
88
+  </component>
89
+  <component name="IdeDocumentHistory">
90
+    <option name="CHANGED_PATHS">
91
+      <list>
92
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
93
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
94
+      </list>
95
+    </option>
96
+  </component>
97
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
98
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
99
+  <component name="JsGulpfileManager">
100
+    <detection-done>true</detection-done>
101
+    <sorting>DEFINITION_ORDER</sorting>
102
+  </component>
103
+  <component name="NodePackageJsonFileManager">
104
+    <packageJsonPaths />
105
+  </component>
106
+  <component name="ProjectFrameBounds">
107
+    <option name="x" value="-425" />
108
+    <option name="y" value="-950" />
109
+    <option name="width" value="1280" />
110
+    <option name="height" value="709" />
111
+  </component>
112
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
113
+  <component name="ProjectView">
114
+    <navigator proportions="" version="1">
115
+      <foldersAlwaysOnTop value="true" />
116
+    </navigator>
117
+    <panes>
118
+      <pane id="AndroidView" />
119
+      <pane id="ProjectPane">
120
+        <subPane>
121
+          <expand>
122
+            <path>
123
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
124
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
125
+            </path>
126
+            <path>
127
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
128
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
129
+              <item name=".idea" type="462c0819:PsiDirectoryNode" />
130
+            </path>
131
+            <path>
132
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
133
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
134
+              <item name="src" type="462c0819:PsiDirectoryNode" />
135
+            </path>
136
+            <path>
137
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
138
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
139
+              <item name="src" type="462c0819:PsiDirectoryNode" />
140
+              <item name="main" type="462c0819:PsiDirectoryNode" />
141
+            </path>
142
+            <path>
143
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
144
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
145
+              <item name="src" type="462c0819:PsiDirectoryNode" />
146
+              <item name="main" type="462c0819:PsiDirectoryNode" />
147
+              <item name="java" type="462c0819:PsiDirectoryNode" />
148
+            </path>
149
+            <path>
150
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
151
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
152
+              <item name="src" type="462c0819:PsiDirectoryNode" />
153
+              <item name="test" type="462c0819:PsiDirectoryNode" />
154
+            </path>
155
+            <path>
156
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
157
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
158
+              <item name="src" type="462c0819:PsiDirectoryNode" />
159
+              <item name="test" type="462c0819:PsiDirectoryNode" />
160
+              <item name="java" type="462c0819:PsiDirectoryNode" />
161
+            </path>
162
+          </expand>
163
+          <select />
164
+        </subPane>
165
+      </pane>
166
+      <pane id="PackagesPane" />
167
+      <pane id="Scope" />
168
+    </panes>
169
+  </component>
170
+  <component name="PropertiesComponent">
171
+    <property name="WebServerToolWindowFactoryState" value="false" />
172
+    <property name="aspect.path.notification.shown" value="true" />
173
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
174
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
175
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
176
+  </component>
177
+  <component name="RunDashboard">
178
+    <option name="ruleStates">
179
+      <list>
180
+        <RuleState>
181
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
182
+        </RuleState>
183
+        <RuleState>
184
+          <option name="name" value="StatusDashboardGroupingRule" />
185
+        </RuleState>
186
+      </list>
187
+    </option>
188
+  </component>
189
+  <component name="RunManager" selected="JUnit.MyArrayListTest">
190
+    <configuration default="true" type="Application" factoryName="Application">
191
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
192
+    </configuration>
193
+    <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
194
+      <module name="generics" />
195
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
196
+      <option name="ALTERNATIVE_JRE_PATH" />
197
+      <option name="PACKAGE_NAME" value="" />
198
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
199
+      <option name="METHOD_NAME" />
200
+      <option name="TEST_OBJECT" value="class" />
201
+      <option name="VM_PARAMETERS" value="-ea" />
202
+      <option name="PARAMETERS" />
203
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
204
+      <option name="PASS_PARENT_ENVS" value="true" />
205
+      <option name="TEST_SEARCH_SCOPE">
206
+        <value defaultName="singleModule" />
207
+      </option>
208
+      <patterns />
209
+    </configuration>
210
+    <configuration name="MyArrayListTest.clearTestIsEmpty" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
211
+      <module name="generics" />
212
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
213
+      <option name="ALTERNATIVE_JRE_PATH" />
214
+      <option name="PACKAGE_NAME" value="" />
215
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
216
+      <option name="METHOD_NAME" value="clearTestIsEmpty" />
217
+      <option name="TEST_OBJECT" value="method" />
218
+      <option name="VM_PARAMETERS" value="-ea" />
219
+      <option name="PARAMETERS" />
220
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
221
+      <option name="PASS_PARENT_ENVS" value="true" />
222
+      <option name="TEST_SEARCH_SCOPE">
223
+        <value defaultName="singleModule" />
224
+      </option>
225
+      <patterns />
226
+    </configuration>
227
+    <configuration name="MyArrayListTest.containsTestFalse" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
228
+      <module name="generics" />
229
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
230
+      <option name="ALTERNATIVE_JRE_PATH" />
231
+      <option name="PACKAGE_NAME" value="" />
232
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
233
+      <option name="METHOD_NAME" value="containsTestFalse" />
234
+      <option name="TEST_OBJECT" value="method" />
235
+      <option name="VM_PARAMETERS" value="-ea" />
236
+      <option name="PARAMETERS" />
237
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
238
+      <option name="PASS_PARENT_ENVS" value="true" />
239
+      <option name="TEST_SEARCH_SCOPE">
240
+        <value defaultName="singleModule" />
241
+      </option>
242
+      <patterns />
243
+    </configuration>
244
+    <configuration name="MyArrayListTest.containsTestTrue" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
245
+      <module name="generics" />
246
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
247
+      <option name="ALTERNATIVE_JRE_PATH" />
248
+      <option name="PACKAGE_NAME" value="" />
249
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
250
+      <option name="METHOD_NAME" value="containsTestTrue" />
251
+      <option name="TEST_OBJECT" value="method" />
252
+      <option name="VM_PARAMETERS" value="-ea" />
253
+      <option name="PARAMETERS" />
254
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
255
+      <option name="PASS_PARENT_ENVS" value="true" />
256
+      <option name="TEST_SEARCH_SCOPE">
257
+        <value defaultName="singleModule" />
258
+      </option>
259
+      <patterns />
260
+    </configuration>
261
+    <configuration name="MyArrayListTest.isEmptyTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
262
+      <module name="generics" />
263
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
264
+      <option name="ALTERNATIVE_JRE_PATH" />
265
+      <option name="PACKAGE_NAME" value="" />
266
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
267
+      <option name="METHOD_NAME" value="isEmptyTest" />
268
+      <option name="TEST_OBJECT" value="method" />
269
+      <option name="VM_PARAMETERS" value="-ea" />
270
+      <option name="PARAMETERS" />
271
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
272
+      <option name="PASS_PARENT_ENVS" value="true" />
273
+      <option name="TEST_SEARCH_SCOPE">
274
+        <value defaultName="singleModule" />
275
+      </option>
276
+      <patterns />
277
+    </configuration>
278
+    <configuration default="true" type="JUnit" factoryName="JUnit">
279
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
280
+      <option name="ALTERNATIVE_JRE_PATH" />
281
+      <option name="PACKAGE_NAME" />
282
+      <option name="MAIN_CLASS_NAME" />
283
+      <option name="METHOD_NAME" />
284
+      <option name="TEST_OBJECT" value="class" />
285
+      <option name="VM_PARAMETERS" value="-ea" />
286
+      <option name="PARAMETERS" />
287
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
288
+      <option name="PASS_PARENT_ENVS" value="true" />
289
+      <option name="TEST_SEARCH_SCOPE">
290
+        <value defaultName="singleModule" />
291
+      </option>
292
+      <patterns />
293
+    </configuration>
294
+    <configuration default="true" type="TestNG" factoryName="TestNG">
295
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
296
+      <option name="ALTERNATIVE_JRE_PATH" />
297
+      <option name="SUITE_NAME" />
298
+      <option name="PACKAGE_NAME" />
299
+      <option name="MAIN_CLASS_NAME" />
300
+      <option name="METHOD_NAME" />
301
+      <option name="GROUP_NAME" />
302
+      <option name="TEST_OBJECT" value="CLASS" />
303
+      <option name="VM_PARAMETERS" value="-ea" />
304
+      <option name="PARAMETERS" />
305
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
306
+      <option name="OUTPUT_DIRECTORY" />
307
+      <option name="PASS_PARENT_ENVS" value="true" />
308
+      <option name="TEST_SEARCH_SCOPE">
309
+        <value defaultName="singleModule" />
310
+      </option>
311
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
312
+      <option name="PROPERTIES_FILE" />
313
+      <properties />
314
+      <listeners />
315
+    </configuration>
316
+    <list>
317
+      <item itemvalue="JUnit.MyArrayListTest.clearTestIsEmpty" />
318
+      <item itemvalue="JUnit.MyArrayListTest.isEmptyTest" />
319
+      <item itemvalue="JUnit.MyArrayListTest.containsTestTrue" />
320
+      <item itemvalue="JUnit.MyArrayListTest.containsTestFalse" />
321
+      <item itemvalue="JUnit.MyArrayListTest" />
322
+    </list>
323
+    <recent_temporary>
324
+      <list>
325
+        <item itemvalue="JUnit.MyArrayListTest" />
326
+        <item itemvalue="JUnit.MyArrayListTest.containsTestFalse" />
327
+        <item itemvalue="JUnit.MyArrayListTest.containsTestTrue" />
328
+        <item itemvalue="JUnit.MyArrayListTest.isEmptyTest" />
329
+        <item itemvalue="JUnit.MyArrayListTest.clearTestIsEmpty" />
330
+      </list>
331
+    </recent_temporary>
332
+  </component>
333
+  <component name="SvnConfiguration">
334
+    <configuration />
335
+  </component>
336
+  <component name="TaskManager">
337
+    <task active="true" id="Default" summary="Default task">
338
+      <changelist id="2dafbc5a-5a43-4fb4-9442-bf3c9d9a408a" name="Default" comment="" />
339
+      <created>1530474956220</created>
340
+      <option name="number" value="Default" />
341
+      <option name="presentableId" value="Default" />
342
+      <updated>1530474956220</updated>
343
+      <workItem from="1530474959556" duration="650000" />
344
+      <workItem from="1530475666647" duration="9043000" />
345
+    </task>
346
+    <servers />
347
+  </component>
348
+  <component name="TestHistory">
349
+    <history-entry file="MyArrayListTest_clearTestForNull - 2018.07.01 at 18h 40m 05s.xml">
350
+      <configuration name="MyArrayListTest.clearTestForNull" configurationId="JUnit" />
351
+    </history-entry>
352
+    <history-entry file="MyArrayListTest_clearTestIsEmpty - 2018.07.01 at 18h 43m 52s.xml">
353
+      <configuration name="MyArrayListTest.clearTestIsEmpty" configurationId="JUnit" />
354
+    </history-entry>
355
+    <history-entry file="MyArrayListTest_clearTestIsEmpty - 2018.07.01 at 18h 44m 50s.xml">
356
+      <configuration name="MyArrayListTest.clearTestIsEmpty" configurationId="JUnit" />
357
+    </history-entry>
358
+    <history-entry file="MyArrayListTest_isEmptyTest - 2018.07.01 at 18h 45m 18s.xml">
359
+      <configuration name="MyArrayListTest.isEmptyTest" configurationId="JUnit" />
360
+    </history-entry>
361
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 52m 36s.xml">
362
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
363
+    </history-entry>
364
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 54m 01s.xml">
365
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
366
+    </history-entry>
367
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 54m 21s.xml">
368
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
369
+    </history-entry>
370
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 54m 31s.xml">
371
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
372
+    </history-entry>
373
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 55m 02s.xml">
374
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
375
+    </history-entry>
376
+    <history-entry file="MyArrayListTest_containsTestTrue - 2018.07.01 at 18h 55m 40s.xml">
377
+      <configuration name="MyArrayListTest.containsTestTrue" configurationId="JUnit" />
378
+    </history-entry>
379
+  </component>
380
+  <component name="TimeTrackingManager">
381
+    <option name="totallyTimeSpent" value="9693000" />
382
+  </component>
383
+  <component name="ToolWindowManager">
384
+    <frame x="-425" y="-950" width="1280" height="709" extended-state="0" />
385
+    <editor active="true" />
386
+    <layout>
387
+      <window_info anchor="right" id="Palette" order="3" />
388
+      <window_info anchor="bottom" id="TODO" order="6" />
389
+      <window_info anchor="bottom" id="Messages" />
390
+      <window_info anchor="right" id="Palette&#9;" order="3" />
391
+      <window_info id="Image Layers" order="2" />
392
+      <window_info anchor="right" id="Capture Analysis" order="3" />
393
+      <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
394
+      <window_info anchor="right" id="Maven Projects" order="3" />
395
+      <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
396
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3293718" />
397
+      <window_info anchor="bottom" id="Version Control" order="7" />
398
+      <window_info anchor="bottom" id="Terminal" order="7" />
399
+      <window_info id="Capture Tool" order="2" />
400
+      <window_info id="Designer" order="2" />
401
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2536349" />
402
+      <window_info anchor="right" id="Database" order="3" />
403
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
404
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
405
+      <window_info id="UI Designer" order="2" />
406
+      <window_info anchor="right" id="Theme Preview" order="3" />
407
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
408
+      <window_info id="Favorites" order="2" side_tool="true" />
409
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
410
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
411
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
412
+      <window_info anchor="bottom" id="Message" order="0" />
413
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
414
+      <window_info anchor="bottom" id="Find" order="1" />
415
+    </layout>
416
+    <layout-to-restore>
417
+      <window_info anchor="right" id="Palette" order="3" />
418
+      <window_info anchor="bottom" id="Find" order="2" />
419
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
420
+      <window_info anchor="right" id="Capture Analysis" order="4" />
421
+      <window_info anchor="bottom" id="Run" order="3" visible="true" weight="0.3293718" />
422
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
423
+      <window_info anchor="bottom" id="Message" order="1" />
424
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2536349" />
425
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
426
+      <window_info anchor="right" id="Theme Preview" order="5" />
427
+      <window_info anchor="bottom" id="TODO" order="7" />
428
+      <window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
429
+      <window_info id="Image Layers" order="2" />
430
+      <window_info id="Designer" order="3" />
431
+      <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
432
+      <window_info id="UI Designer" order="4" />
433
+      <window_info anchor="bottom" id="Debug" order="4" weight="0.4" />
434
+      <window_info anchor="right" id="Database" order="6" />
435
+      <window_info anchor="right" id="Palette&#9;" order="7" />
436
+      <window_info anchor="bottom" id="Terminal" order="9" />
437
+      <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
438
+      <window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
439
+      <window_info anchor="bottom" id="Version Control" order="11" />
440
+      <window_info id="Capture Tool" order="5" />
441
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
442
+      <window_info anchor="bottom" id="Messages" order="0" />
443
+      <window_info anchor="right" id="Maven Projects" order="8" />
444
+      <window_info id="Favorites" order="6" side_tool="true" />
445
+    </layout-to-restore>
446
+  </component>
447
+  <component name="TypeScriptGeneratedFilesManager">
448
+    <option name="version" value="1" />
449
+  </component>
450
+  <component name="VcsContentAnnotationSettings">
451
+    <option name="myLimit" value="2678400000" />
452
+  </component>
453
+  <component name="editorHistoryManager">
454
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
455
+      <provider selected="true" editor-type-id="text-editor">
456
+        <state relative-caret-position="240">
457
+          <caret line="16" column="1" lean-forward="true" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
458
+          <folding>
459
+            <element signature="imports" expanded="true" />
460
+          </folding>
461
+        </state>
462
+      </provider>
463
+    </entry>
464
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
465
+      <provider selected="true" editor-type-id="text-editor">
466
+        <state>
467
+          <caret column="22" selection-start-column="22" selection-end-column="22" />
468
+        </state>
469
+      </provider>
470
+    </entry>
471
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
472
+      <provider selected="true" editor-type-id="text-editor">
473
+        <state>
474
+          <caret column="22" selection-start-column="22" selection-end-column="22" />
475
+        </state>
476
+      </provider>
477
+    </entry>
478
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
479
+      <provider selected="true" editor-type-id="text-editor">
480
+        <state relative-caret-position="180">
481
+          <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
482
+          <folding>
483
+            <element signature="imports" expanded="true" />
484
+            <element signature="e#131#132#0" expanded="true" />
485
+            <element signature="e#179#180#0" expanded="true" />
486
+            <element signature="e#142#143#0" expanded="true" />
487
+            <element signature="e#176#177#0" expanded="true" />
488
+            <element signature="e#1004#1005#0" expanded="true" />
489
+            <element signature="e#1041#1042#0" expanded="true" />
490
+            <element signature="e#1728#1729#0" expanded="true" />
491
+            <element signature="e#1757#1758#0" expanded="true" />
492
+          </folding>
493
+        </state>
494
+      </provider>
495
+    </entry>
496
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
497
+      <provider selected="true" editor-type-id="text-editor">
498
+        <state>
499
+          <caret column="22" selection-start-column="22" selection-end-column="22" />
500
+        </state>
501
+      </provider>
502
+    </entry>
503
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
504
+      <provider selected="true" editor-type-id="text-editor">
505
+        <state>
506
+          <caret column="22" selection-start-column="22" selection-end-column="22" />
507
+        </state>
508
+      </provider>
509
+    </entry>
510
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/src.zip!/java/lang/System.java">
511
+      <provider selected="true" editor-type-id="text-editor">
512
+        <state relative-caret-position="-6382">
513
+          <caret line="58" column="19" selection-start-line="58" selection-start-column="19" selection-end-line="58" selection-end-column="19" />
514
+        </state>
515
+      </provider>
516
+    </entry>
517
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
518
+      <provider selected="true" editor-type-id="text-editor">
519
+        <state relative-caret-position="269">
520
+          <caret line="319" column="12" lean-forward="true" selection-start-line="319" selection-start-column="12" selection-end-line="320" selection-end-column="45" />
521
+        </state>
522
+      </provider>
523
+    </entry>
524
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
525
+      <provider selected="true" editor-type-id="text-editor">
526
+        <state relative-caret-position="228">
527
+          <caret line="81" column="34" lean-forward="true" selection-start-line="81" selection-start-column="34" selection-end-line="81" selection-end-column="34" />
528
+          <folding>
529
+            <element signature="imports" expanded="true" />
530
+            <element signature="e#131#132#0" expanded="true" />
531
+            <element signature="e#179#180#0" expanded="true" />
532
+            <element signature="e#142#143#0" expanded="true" />
533
+            <element signature="e#176#177#0" expanded="true" />
534
+            <element signature="e#1004#1005#0" expanded="true" />
535
+            <element signature="e#1041#1042#0" expanded="true" />
536
+            <element signature="e#1728#1729#0" expanded="true" />
537
+            <element signature="e#1757#1758#0" expanded="true" />
538
+          </folding>
539
+        </state>
540
+      </provider>
541
+    </entry>
542
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
543
+      <provider selected="true" editor-type-id="text-editor">
544
+        <state relative-caret-position="276">
545
+          <caret line="173" selection-start-line="173" selection-end-line="173" />
546
+          <folding>
547
+            <element signature="imports" expanded="true" />
548
+          </folding>
549
+        </state>
550
+      </provider>
551
+    </entry>
552
+  </component>
553
+  <component name="masterDetails">
554
+    <states>
555
+      <state key="ProjectJDKs.UI">
556
+        <settings>
557
+          <last-edited>1.8</last-edited>
558
+          <splitter-proportions>
559
+            <option name="proportions">
560
+              <list>
561
+                <option value="0.2" />
562
+              </list>
563
+            </option>
564
+          </splitter-proportions>
565
+        </settings>
566
+      </state>
567
+    </states>
568
+  </component>
569
+</project>

+ 16
- 0
generics.iml 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
4
+    <output url="file://$MODULE_DIR$/target/classes" />
5
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
+    <content url="file://$MODULE_DIR$">
7
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9
+      <excludeFolder url="file://$MODULE_DIR$/target" />
10
+    </content>
11
+    <orderEntry type="inheritedJdk" />
12
+    <orderEntry type="sourceFolder" forTests="false" />
13
+    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
14
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
+  </component>
16
+</module>

+ 89
- 0
src/main/java/MyArrayList.java 查看文件

@@ -0,0 +1,89 @@
1
+import java.util.ArrayList;
2
+import java.util.Arrays;
3
+
4
+public class MyArrayList<T> {
5
+
6
+    T[] array;
7
+    int size;
8
+
9
+    public MyArrayList() {
10
+        this.array = (T[]) new Object[0];
11
+    }
12
+
13
+    public MyArrayList(int i) {
14
+        if (i > 0) {
15
+            this.array = (T[]) new Object[i];
16
+            size = i;
17
+        } else if (i == 0) {
18
+            new MyArrayList();
19
+        } else {
20
+            throw new IllegalArgumentException("Illegal Capacity: "+
21
+                    i);
22
+        }
23
+    }
24
+
25
+    public int size() {
26
+        return size;
27
+    }
28
+
29
+    public boolean add(T t) {
30
+       this.array = Arrays.copyOf(array, size + 1);
31
+       array[size-1] = t;
32
+       size++;
33
+       return true;
34
+    }
35
+
36
+    //    rangeCheckForAdd(index);
37
+//
38
+//    ensureCapacityInternal(size + 1);  // Increments modCount!!
39
+//        System.arraycopy(elementData, index, elementData, index + 1,
40
+//    size - index);
41
+//    elementData[index] = element;
42
+//    size++;
43
+
44
+    public boolean add(T t, int index) {
45
+        array = Arrays.copyOf(this.array, size + 1);
46
+        System.arraycopy(array, index, array, index + 1,
47
+                size - index);
48
+        array[index] = t;
49
+        size++;
50
+        return true;
51
+    }
52
+
53
+    public T get(int index){
54
+        return array[index];
55
+    }
56
+
57
+    public T remove(int index){
58
+        T oldValue = array[index];
59
+        System.arraycopy(array, index+1, array, index,
60
+                size - index - 1);
61
+        array[--size] = null;
62
+        return oldValue;
63
+    }
64
+
65
+
66
+    public T set(int i, T t) {
67
+        T oldValue = array[i];
68
+        array[i] = t;
69
+        return oldValue;
70
+    }
71
+
72
+    public void clear() {
73
+        for(T t : array)
74
+            t = null;
75
+        size = 0;
76
+    }
77
+
78
+    public boolean isEmpty() {
79
+        return size == 0;
80
+    }
81
+
82
+    public boolean contains(T t) {
83
+        int count = 0;
84
+        for (T x : array)
85
+            count += (t.equals(x))? 1 : 0;
86
+
87
+        return count > 0;
88
+    }
89
+}

+ 178
- 0
src/test/java/MyArrayListTest.java 查看文件

@@ -0,0 +1,178 @@
1
+import org.junit.Before;
2
+import org.junit.Test;
3
+
4
+import static org.junit.Assert.assertEquals;
5
+import static org.junit.Assert.assertFalse;
6
+import static org.junit.Assert.assertTrue;
7
+
8
+public class MyArrayListTest <T>{
9
+
10
+    @Before
11
+    public void setup(){
12
+
13
+
14
+    }
15
+
16
+
17
+    @Test
18
+    public void initializationTestNoParameters(){
19
+        MyArrayList myArrayList = new MyArrayList();
20
+        int expected = 0;
21
+        int actual = myArrayList.size();
22
+        assertEquals(expected,actual);
23
+    }
24
+
25
+    @Test
26
+    public void initializationTestLengthParameter(){
27
+        MyArrayList myArrayList = new MyArrayList(10);
28
+        int expected = 10;
29
+        int actual = myArrayList.size();
30
+        assertEquals(expected,actual);
31
+    }
32
+
33
+    @Test
34
+    public void addTestAddNoParameters(){
35
+        T t = null;
36
+        MyArrayList myArrayList = new MyArrayList(10);
37
+        myArrayList.add(t);
38
+        int expected = 11;
39
+        int actual = myArrayList.size();
40
+        assertEquals(expected,actual);
41
+    }
42
+
43
+    @Test
44
+    public void addTestAddNoParametersAddsAtEnd(){
45
+        T t = null;
46
+        MyArrayList myArrayList = new MyArrayList(10);
47
+        myArrayList.add(t);
48
+        T expected = null;
49
+        T actual = (T) myArrayList.get(10);
50
+        assertEquals(expected,actual);
51
+    }
52
+
53
+    @Test
54
+    public void addTestAddWithSpecifiedIndex(){
55
+        T t = null;
56
+        MyArrayList myArrayList = new MyArrayList(10);
57
+        myArrayList.add(t, 4);
58
+        int expected = 11;
59
+        int actual = myArrayList.size();
60
+        assertEquals(expected,actual);
61
+    }
62
+
63
+    @Test
64
+    public void addTestAddWithSpecifiedIndexAddsAtIndex(){
65
+        T t = null;
66
+        MyArrayList myArrayList = new MyArrayList(10);
67
+        myArrayList.add(t, 4);
68
+        T expected = null;
69
+        T actual = (T) myArrayList.get(4);
70
+        assertEquals(expected,actual);
71
+    }
72
+
73
+    @Test
74
+    public void removeTestForValue(){
75
+        MyArrayList myArrayList = new MyArrayList(10);
76
+        T actual = (T) myArrayList.remove(4);
77
+        T expected = null;
78
+        assertEquals(expected,actual);
79
+    }
80
+
81
+    @Test
82
+    public void removeTestForSize(){
83
+        MyArrayList myArrayList = new MyArrayList(10);
84
+        myArrayList.remove(4);
85
+        int expected = 9;
86
+        int actual = myArrayList.size();
87
+        assertEquals(expected,actual);
88
+    }
89
+
90
+    @Test
91
+    public void setTestForSize(){
92
+        T t = null;
93
+        MyArrayList myArrayList = new MyArrayList(10);
94
+        myArrayList.set(4, t);
95
+        int expected = 10;
96
+        int actual = myArrayList.size();
97
+        assertEquals(expected,actual);
98
+    }
99
+
100
+    @Test
101
+    public void setTestForReturn(){
102
+        T t = null;
103
+        MyArrayList myArrayList = new MyArrayList(10);
104
+        myArrayList.set(4, t);
105
+        T expected = (T) myArrayList.get(4);
106
+        T actual = (T) myArrayList.set(4, t);
107
+        assertEquals(expected,actual);
108
+    }
109
+
110
+    @Test
111
+    public void setTestForSet(){
112
+        String expected = "bear";
113
+        MyArrayList myArrayList = new MyArrayList(10);
114
+        myArrayList.set(4, expected);
115
+        String actual = (String) myArrayList.get(4);
116
+        assertEquals(expected,actual);
117
+    }
118
+
119
+    @Test
120
+    public void clearTestForSize(){
121
+
122
+        MyArrayList myArrayList = new MyArrayList(10);
123
+        myArrayList.clear();
124
+        int expected = 0;
125
+        int actual = myArrayList.size();
126
+        assertEquals(expected,actual);
127
+    }
128
+
129
+    @Test
130
+    public void clearTestForNull(){
131
+
132
+        MyArrayList myArrayList = new MyArrayList(10);
133
+        myArrayList.clear();
134
+        T expected = null;
135
+        T actual = (T) myArrayList.get(4);
136
+
137
+        assertEquals(expected,actual);
138
+    }
139
+
140
+    @Test
141
+    public void clearTestIsEmpty(){
142
+
143
+        MyArrayList myArrayList = new MyArrayList(10);
144
+        myArrayList.clear();
145
+        boolean actual = myArrayList.isEmpty();
146
+
147
+        assertTrue(actual);
148
+    }
149
+
150
+    @Test
151
+    public void isEmptyTest(){
152
+        MyArrayList myArrayList = new MyArrayList(10);
153
+        boolean actual = myArrayList.isEmpty();
154
+
155
+        assertFalse(actual);
156
+    }
157
+
158
+    @Test
159
+    public void containsTestFalse(){
160
+        MyArrayList myArrayList = new MyArrayList(10);
161
+        boolean actual = myArrayList.contains("bear");
162
+        assertFalse(actual);
163
+    }
164
+
165
+    @Test
166
+    public void containsTestTrue(){
167
+        String expected = "bear";
168
+        MyArrayList myArrayList = new MyArrayList(10);
169
+        myArrayList.set(4, expected);
170
+
171
+        boolean actual = myArrayList.contains("bear");
172
+
173
+        assertTrue(actual);
174
+    }
175
+
176
+
177
+
178
+}

+ 2
- 0
src/test/java/MyMapTest.java 查看文件

@@ -0,0 +1,2 @@
1
+public class MyMapTest {
2
+}

+ 2
- 0
src/test/java/MySetTest.java 查看文件

@@ -0,0 +1,2 @@
1
+public class MySetTest {
2
+}