Bläddra i källkod

completed myArrayList lab

Jonathan Hinds 6 år sedan
förälder
incheckning
ef3628d830

+ 1
- 0
.idea/.name Visa fil

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

+ 16
- 0
.idea/compiler.xml Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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>

+ 577
- 0
.idea/workspace.xml Visa fil

@@ -0,0 +1,577 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="aa9fca72-ec79-4d9c-a592-342f9cdda651" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/generics.iml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyCollections.java" afterDir="false" />
10
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyMap.java" afterDir="false" />
11
+      <change afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
12
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
13
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
14
+      <change afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
15
+    </list>
16
+    <ignored path="$PROJECT_DIR$/target/" />
17
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
18
+    <option name="SHOW_DIALOG" value="false" />
19
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
20
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
21
+    <option name="LAST_RESOLUTION" value="IGNORE" />
22
+  </component>
23
+  <component name="FUSProjectUsageTrigger">
24
+    <session id="-1634872505">
25
+      <usages-collector id="statistics.lifecycle.project">
26
+        <counts>
27
+          <entry key="project.open.time.3" value="1" />
28
+          <entry key="project.opened" value="1" />
29
+        </counts>
30
+      </usages-collector>
31
+      <usages-collector id="statistics.file.extensions.open">
32
+        <counts>
33
+          <entry key="class" value="5" />
34
+          <entry key="java" value="9" />
35
+          <entry key="md" value="3" />
36
+        </counts>
37
+      </usages-collector>
38
+      <usages-collector id="statistics.file.types.open">
39
+        <counts>
40
+          <entry key="CLASS" value="5" />
41
+          <entry key="JAVA" value="9" />
42
+          <entry key="Markdown" value="3" />
43
+        </counts>
44
+      </usages-collector>
45
+      <usages-collector id="statistics.file.extensions.edit">
46
+        <counts>
47
+          <entry key="java" value="9558" />
48
+        </counts>
49
+      </usages-collector>
50
+      <usages-collector id="statistics.file.types.edit">
51
+        <counts>
52
+          <entry key="JAVA" value="9558" />
53
+        </counts>
54
+      </usages-collector>
55
+    </session>
56
+  </component>
57
+  <component name="FileEditorManager">
58
+    <splitter split-orientation="vertical" split-proportion="0.8565965">
59
+      <split-first>
60
+        <leaf>
61
+          <file pinned="false" current-in-tab="false">
62
+            <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
63
+              <provider selected="true" editor-type-id="text-editor">
64
+                <state relative-caret-position="198">
65
+                  <caret line="75" column="31" selection-start-line="75" selection-start-column="31" selection-end-line="75" selection-end-column="31" />
66
+                  <folding>
67
+                    <element signature="imports" expanded="true" />
68
+                    <element signature="e#304#305#0" expanded="true" />
69
+                    <element signature="e#353#354#0" expanded="true" />
70
+                    <element signature="method#MyArrayList#1;class#MyArrayList#0" />
71
+                    <element signature="method#add#1;class#MyArrayList#0" />
72
+                    <element signature="e#1002#1003#0" expanded="true" />
73
+                    <element signature="e#1034#1035#0" expanded="true" />
74
+                    <element signature="e#1062#1063#0" expanded="true" />
75
+                    <element signature="e#1095#1096#0" expanded="true" />
76
+                    <element signature="e#1456#1457#0" expanded="true" />
77
+                    <element signature="e#1495#1496#0" expanded="true" />
78
+                    <element signature="e#1860#1861#0" expanded="true" />
79
+                    <element signature="e#1897#1898#0" expanded="true" />
80
+                  </folding>
81
+                </state>
82
+              </provider>
83
+            </entry>
84
+          </file>
85
+          <file pinned="false" current-in-tab="false">
86
+            <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
87
+              <provider selected="true" editor-type-id="text-editor">
88
+                <state relative-caret-position="508">
89
+                  <caret line="134" column="9" lean-forward="true" selection-start-line="134" selection-start-column="9" selection-end-line="134" selection-end-column="9" />
90
+                  <folding>
91
+                    <element signature="imports" expanded="true" />
92
+                  </folding>
93
+                </state>
94
+              </provider>
95
+            </entry>
96
+          </file>
97
+          <file pinned="false" current-in-tab="false">
98
+            <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
99
+              <provider selected="true" editor-type-id="text-editor">
100
+                <state>
101
+                  <caret column="61" selection-start-column="61" selection-end-column="61" />
102
+                  <folding>
103
+                    <element signature="e#212#213#0" expanded="true" />
104
+                    <element signature="e#248#249#0" expanded="true" />
105
+                    <element signature="e#270#271#0" expanded="true" />
106
+                    <element signature="e#320#321#0" expanded="true" />
107
+                    <element signature="method#add#0;class#MySet#0" />
108
+                    <element signature="method#contains#0;class#MySet#0" />
109
+                    <element signature="method#addAll#0;class#MySet#0" />
110
+                    <element signature="method#toArray#0;class#MySet#0" />
111
+                    <element signature="e#1258#1259#0" expanded="true" />
112
+                    <element signature="e#1302#1303#0" expanded="true" />
113
+                  </folding>
114
+                </state>
115
+              </provider>
116
+            </entry>
117
+          </file>
118
+          <file pinned="false" current-in-tab="false">
119
+            <entry file="file://$PROJECT_DIR$/src/main/java/MyCollections.java">
120
+              <provider selected="true" editor-type-id="text-editor">
121
+                <state relative-caret-position="45">
122
+                  <caret line="3" column="17" selection-start-line="3" selection-start-column="17" selection-end-line="3" selection-end-column="17" />
123
+                </state>
124
+              </provider>
125
+            </entry>
126
+          </file>
127
+          <file pinned="false" current-in-tab="false">
128
+            <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
129
+              <provider selected="true" editor-type-id="text-editor">
130
+                <state relative-caret-position="8">
131
+                  <caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
132
+                  <folding>
133
+                    <element signature="imports" expanded="true" />
134
+                    <element signature="e#579#588#0" expanded="true" />
135
+                    <element signature="e#879#888#0" expanded="true" />
136
+                  </folding>
137
+                </state>
138
+              </provider>
139
+            </entry>
140
+          </file>
141
+          <file pinned="false" current-in-tab="false">
142
+            <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
143
+              <provider selected="true" editor-type-id="text-editor">
144
+                <state relative-caret-position="213">
145
+                  <caret line="60" column="41" selection-start-line="60" selection-start-column="41" selection-end-line="60" selection-end-column="41" />
146
+                  <folding>
147
+                    <element signature="e#268#269#0" expanded="true" />
148
+                    <element signature="e#310#311#0" expanded="true" />
149
+                    <element signature="e#424#425#0" expanded="true" />
150
+                    <element signature="e#453#454#0" expanded="true" />
151
+                    <element signature="e#364#365#0" expanded="true" />
152
+                    <element signature="e#398#399#0" expanded="true" />
153
+                    <element signature="e#622#623#0" expanded="true" />
154
+                    <element signature="e#661#662#0" expanded="true" />
155
+                    <element signature="e#1071#1072#0" expanded="true" />
156
+                    <element signature="e#1108#1109#0" expanded="true" />
157
+                    <element signature="e#1048#1049#0" expanded="true" />
158
+                    <element signature="e#1075#1076#0" expanded="true" />
159
+                    <element signature="e#1646#1647#0" expanded="true" />
160
+                    <element signature="e#1683#1684#0" expanded="true" />
161
+                  </folding>
162
+                </state>
163
+              </provider>
164
+            </entry>
165
+          </file>
166
+          <file pinned="false" current-in-tab="true">
167
+            <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
168
+              <provider selected="true" editor-type-id="text-editor">
169
+                <state relative-caret-position="281">
170
+                  <caret line="39" column="39" lean-forward="true" selection-start-line="39" selection-start-column="39" selection-end-line="39" selection-end-column="39" />
171
+                  <folding>
172
+                    <element signature="imports" expanded="true" />
173
+                  </folding>
174
+                </state>
175
+              </provider>
176
+            </entry>
177
+          </file>
178
+        </leaf>
179
+      </split-first>
180
+      <split-second>
181
+        <leaf>
182
+          <file pinned="false" current-in-tab="true">
183
+            <entry file="file://$PROJECT_DIR$/README.md">
184
+              <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
185
+                <state split_layout="SPLIT">
186
+                  <first_editor />
187
+                  <second_editor />
188
+                </state>
189
+              </provider>
190
+            </entry>
191
+          </file>
192
+        </leaf>
193
+      </split-second>
194
+    </splitter>
195
+  </component>
196
+  <component name="FileTemplateManagerImpl">
197
+    <option name="RECENT_TEMPLATES">
198
+      <list>
199
+        <option value="Interface" />
200
+        <option value="Class" />
201
+      </list>
202
+    </option>
203
+  </component>
204
+  <component name="Git.Settings">
205
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
206
+  </component>
207
+  <component name="IdeDocumentHistory">
208
+    <option name="CHANGED_PATHS">
209
+      <list>
210
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
211
+        <option value="$PROJECT_DIR$/src/main/java/MyCollections.java" />
212
+        <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
213
+        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
214
+        <option value="$PROJECT_DIR$/src/test/java/MyMapTest.java" />
215
+        <option value="$PROJECT_DIR$/src/main/java/MyMap.java" />
216
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
217
+      </list>
218
+    </option>
219
+  </component>
220
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
221
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
222
+  <component name="JsGulpfileManager">
223
+    <detection-done>true</detection-done>
224
+    <sorting>DEFINITION_ORDER</sorting>
225
+  </component>
226
+  <component name="ProjectFrameBounds" fullScreen="true">
227
+    <option name="width" value="1280" />
228
+    <option name="height" value="800" />
229
+  </component>
230
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
231
+  <component name="ProjectView">
232
+    <navigator proportions="" version="1">
233
+      <foldersAlwaysOnTop value="true" />
234
+    </navigator>
235
+    <panes>
236
+      <pane id="PackagesPane" />
237
+      <pane id="ProjectPane">
238
+        <subPane>
239
+          <expand>
240
+            <path>
241
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
242
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
243
+            </path>
244
+            <path>
245
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
246
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
247
+              <item name="src" type="462c0819:PsiDirectoryNode" />
248
+            </path>
249
+            <path>
250
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
251
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
252
+              <item name="src" type="462c0819:PsiDirectoryNode" />
253
+              <item name="main" type="462c0819:PsiDirectoryNode" />
254
+            </path>
255
+            <path>
256
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
257
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
258
+              <item name="src" type="462c0819:PsiDirectoryNode" />
259
+              <item name="main" type="462c0819:PsiDirectoryNode" />
260
+              <item name="java" type="462c0819:PsiDirectoryNode" />
261
+            </path>
262
+            <path>
263
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
264
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
265
+              <item name="src" type="462c0819:PsiDirectoryNode" />
266
+              <item name="test" type="462c0819:PsiDirectoryNode" />
267
+            </path>
268
+            <path>
269
+              <item name="generics" type="b2602c69:ProjectViewProjectNode" />
270
+              <item name="CR-MicroLabs-Generics-MyArrayList" type="462c0819:PsiDirectoryNode" />
271
+              <item name="src" type="462c0819:PsiDirectoryNode" />
272
+              <item name="test" type="462c0819:PsiDirectoryNode" />
273
+              <item name="java" type="462c0819:PsiDirectoryNode" />
274
+            </path>
275
+          </expand>
276
+          <select />
277
+        </subPane>
278
+      </pane>
279
+      <pane id="Scope" />
280
+    </panes>
281
+  </component>
282
+  <component name="PropertiesComponent">
283
+    <property name="WebServerToolWindowFactoryState" value="false" />
284
+    <property name="aspect.path.notification.shown" value="true" />
285
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542239824066" />
286
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
287
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
288
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
289
+  </component>
290
+  <component name="RunDashboard">
291
+    <option name="ruleStates">
292
+      <list>
293
+        <RuleState>
294
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
295
+        </RuleState>
296
+        <RuleState>
297
+          <option name="name" value="StatusDashboardGroupingRule" />
298
+        </RuleState>
299
+      </list>
300
+    </option>
301
+  </component>
302
+  <component name="RunManager" selected="JUnit.MyMapTest">
303
+    <configuration name="MyMapTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
304
+      <module name="generics" />
305
+      <option name="PACKAGE_NAME" value="" />
306
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
307
+      <method v="2">
308
+        <option name="Make" enabled="true" />
309
+      </method>
310
+    </configuration>
311
+    <configuration name="MyMapTest.testGetMethod" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
312
+      <module name="generics" />
313
+      <option name="PACKAGE_NAME" value="" />
314
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
315
+      <option name="METHOD_NAME" value="testGetMethod" />
316
+      <option name="TEST_OBJECT" value="method" />
317
+      <method v="2">
318
+        <option name="Make" enabled="true" />
319
+      </method>
320
+    </configuration>
321
+    <configuration name="MyMapTest.testKeySet" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
322
+      <module name="generics" />
323
+      <option name="PACKAGE_NAME" value="" />
324
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
325
+      <option name="METHOD_NAME" value="testKeySet" />
326
+      <option name="TEST_OBJECT" value="method" />
327
+      <method v="2">
328
+        <option name="Make" enabled="true" />
329
+      </method>
330
+    </configuration>
331
+    <configuration name="MyMapTest.testPutMultiples" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
332
+      <module name="generics" />
333
+      <option name="PACKAGE_NAME" value="" />
334
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
335
+      <option name="METHOD_NAME" value="testPutMultiples" />
336
+      <option name="TEST_OBJECT" value="method" />
337
+      <method v="2">
338
+        <option name="Make" enabled="true" />
339
+      </method>
340
+    </configuration>
341
+    <configuration name="MyMapTest.testRemove" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
342
+      <module name="generics" />
343
+      <option name="PACKAGE_NAME" value="" />
344
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
345
+      <option name="METHOD_NAME" value="testRemove" />
346
+      <option name="TEST_OBJECT" value="method" />
347
+      <method v="2">
348
+        <option name="Make" enabled="true" />
349
+      </method>
350
+    </configuration>
351
+    <list>
352
+      <item itemvalue="JUnit.MyMapTest.testPutMultiples" />
353
+      <item itemvalue="JUnit.MyMapTest.testRemove" />
354
+      <item itemvalue="JUnit.MyMapTest" />
355
+      <item itemvalue="JUnit.MyMapTest.testKeySet" />
356
+      <item itemvalue="JUnit.MyMapTest.testGetMethod" />
357
+    </list>
358
+    <recent_temporary>
359
+      <list>
360
+        <item itemvalue="JUnit.MyMapTest" />
361
+        <item itemvalue="JUnit.MyMapTest.testGetMethod" />
362
+        <item itemvalue="JUnit.MyMapTest.testKeySet" />
363
+        <item itemvalue="JUnit.MyMapTest.testPutMultiples" />
364
+        <item itemvalue="JUnit.MyMapTest.testRemove" />
365
+      </list>
366
+    </recent_temporary>
367
+  </component>
368
+  <component name="SvnConfiguration">
369
+    <configuration />
370
+  </component>
371
+  <component name="TaskManager">
372
+    <task active="true" id="Default" summary="Default task">
373
+      <changelist id="aa9fca72-ec79-4d9c-a592-342f9cdda651" name="Default Changelist" comment="" />
374
+      <created>1542159433757</created>
375
+      <option name="number" value="Default" />
376
+      <option name="presentableId" value="Default" />
377
+      <updated>1542159433757</updated>
378
+      <workItem from="1542159437542" duration="17307000" />
379
+    </task>
380
+    <servers />
381
+  </component>
382
+  <component name="TestHistory">
383
+    <history-entry file="MyMapTest_testPut - 2018.11.14 at 18h 47m 55s.xml">
384
+      <configuration name="MyMapTest.testPut" configurationId="JUnit" />
385
+    </history-entry>
386
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 47m 58s.xml">
387
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
388
+    </history-entry>
389
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 50m 56s.xml">
390
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
391
+    </history-entry>
392
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 51m 46s.xml">
393
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
394
+    </history-entry>
395
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 52m 04s.xml">
396
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
397
+    </history-entry>
398
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 52m 23s.xml">
399
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
400
+    </history-entry>
401
+    <history-entry file="MyMapTest_testPutMultiples - 2018.11.14 at 18h 53m 03s.xml">
402
+      <configuration name="MyMapTest.testPutMultiples" configurationId="JUnit" />
403
+    </history-entry>
404
+    <history-entry file="MyMapTest_testRemove - 2018.11.14 at 18h 53m 51s.xml">
405
+      <configuration name="MyMapTest.testRemove" configurationId="JUnit" />
406
+    </history-entry>
407
+    <history-entry file="MyMapTest_testRemove - 2018.11.14 at 18h 54m 07s.xml">
408
+      <configuration name="MyMapTest.testRemove" configurationId="JUnit" />
409
+    </history-entry>
410
+    <history-entry file="MyMapTest_testRemove - 2018.11.14 at 18h 54m 41s.xml">
411
+      <configuration name="MyMapTest.testRemove" configurationId="JUnit" />
412
+    </history-entry>
413
+  </component>
414
+  <component name="TimeTrackingManager">
415
+    <option name="totallyTimeSpent" value="17307000" />
416
+  </component>
417
+  <component name="ToolWindowManager">
418
+    <frame x="0" y="0" width="1280" height="800" extended-state="0" />
419
+    <editor active="true" />
420
+    <layout>
421
+      <window_info id="Image Layers" />
422
+      <window_info id="Designer" />
423
+      <window_info id="UI Designer" />
424
+      <window_info id="Capture Tool" />
425
+      <window_info id="Favorites" side_tool="true" />
426
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2463651" />
427
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
428
+      <window_info anchor="bottom" id="Messages" weight="0.32739726" />
429
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
430
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
431
+      <window_info anchor="bottom" id="Terminal" />
432
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
433
+      <window_info anchor="bottom" id="Message" order="0" />
434
+      <window_info anchor="bottom" id="Find" order="1" />
435
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.28356165" />
436
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.39863014" />
437
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
438
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
439
+      <window_info anchor="bottom" id="TODO" order="6" />
440
+      <window_info anchor="right" id="Palette" />
441
+      <window_info anchor="right" id="Theme Preview" />
442
+      <window_info anchor="right" id="Capture Analysis" />
443
+      <window_info anchor="right" id="Palette&#9;" />
444
+      <window_info anchor="right" id="Database" />
445
+      <window_info anchor="right" id="Maven Projects" />
446
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
447
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
448
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
449
+    </layout>
450
+  </component>
451
+  <component name="TypeScriptGeneratedFilesManager">
452
+    <option name="version" value="1" />
453
+  </component>
454
+  <component name="VcsContentAnnotationSettings">
455
+    <option name="myLimit" value="2678400000" />
456
+  </component>
457
+  <component name="editorHistoryManager">
458
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
459
+      <provider selected="true" editor-type-id="text-editor">
460
+        <state relative-caret-position="195">
461
+          <caret line="16" selection-start-line="16" selection-end-line="16" />
462
+        </state>
463
+      </provider>
464
+    </entry>
465
+    <entry file="file://$PROJECT_DIR$/README.md">
466
+      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
467
+        <state split_layout="SPLIT">
468
+          <first_editor />
469
+          <second_editor />
470
+        </state>
471
+      </provider>
472
+    </entry>
473
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyCollections.java">
474
+      <provider selected="true" editor-type-id="text-editor">
475
+        <state relative-caret-position="45">
476
+          <caret line="3" column="17" selection-start-line="3" selection-start-column="17" selection-end-line="3" selection-end-column="17" />
477
+        </state>
478
+      </provider>
479
+    </entry>
480
+    <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
481
+      <provider selected="true" editor-type-id="text-editor">
482
+        <state>
483
+          <caret column="61" selection-start-column="61" selection-end-column="61" />
484
+          <folding>
485
+            <element signature="e#212#213#0" expanded="true" />
486
+            <element signature="e#248#249#0" expanded="true" />
487
+            <element signature="e#270#271#0" expanded="true" />
488
+            <element signature="e#320#321#0" expanded="true" />
489
+            <element signature="method#add#0;class#MySet#0" />
490
+            <element signature="method#contains#0;class#MySet#0" />
491
+            <element signature="method#addAll#0;class#MySet#0" />
492
+            <element signature="method#toArray#0;class#MySet#0" />
493
+            <element signature="e#1258#1259#0" expanded="true" />
494
+            <element signature="e#1302#1303#0" expanded="true" />
495
+          </folding>
496
+        </state>
497
+      </provider>
498
+    </entry>
499
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
500
+      <provider selected="true" editor-type-id="text-editor">
501
+        <state relative-caret-position="8">
502
+          <caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
503
+          <folding>
504
+            <element signature="imports" expanded="true" />
505
+            <element signature="e#579#588#0" expanded="true" />
506
+            <element signature="e#879#888#0" expanded="true" />
507
+          </folding>
508
+        </state>
509
+      </provider>
510
+    </entry>
511
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
512
+      <provider selected="true" editor-type-id="text-editor">
513
+        <state relative-caret-position="508">
514
+          <caret line="134" column="9" lean-forward="true" selection-start-line="134" selection-start-column="9" selection-end-line="134" selection-end-column="9" />
515
+          <folding>
516
+            <element signature="imports" expanded="true" />
517
+          </folding>
518
+        </state>
519
+      </provider>
520
+    </entry>
521
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
522
+      <provider selected="true" editor-type-id="text-editor">
523
+        <state relative-caret-position="198">
524
+          <caret line="75" column="31" selection-start-line="75" selection-start-column="31" selection-end-line="75" selection-end-column="31" />
525
+          <folding>
526
+            <element signature="imports" expanded="true" />
527
+            <element signature="e#304#305#0" expanded="true" />
528
+            <element signature="e#353#354#0" expanded="true" />
529
+            <element signature="method#MyArrayList#1;class#MyArrayList#0" />
530
+            <element signature="method#add#1;class#MyArrayList#0" />
531
+            <element signature="e#1002#1003#0" expanded="true" />
532
+            <element signature="e#1034#1035#0" expanded="true" />
533
+            <element signature="e#1062#1063#0" expanded="true" />
534
+            <element signature="e#1095#1096#0" expanded="true" />
535
+            <element signature="e#1456#1457#0" expanded="true" />
536
+            <element signature="e#1495#1496#0" expanded="true" />
537
+            <element signature="e#1860#1861#0" expanded="true" />
538
+            <element signature="e#1897#1898#0" expanded="true" />
539
+          </folding>
540
+        </state>
541
+      </provider>
542
+    </entry>
543
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
544
+      <provider selected="true" editor-type-id="text-editor">
545
+        <state relative-caret-position="213">
546
+          <caret line="60" column="41" selection-start-line="60" selection-start-column="41" selection-end-line="60" selection-end-column="41" />
547
+          <folding>
548
+            <element signature="e#268#269#0" expanded="true" />
549
+            <element signature="e#310#311#0" expanded="true" />
550
+            <element signature="e#424#425#0" expanded="true" />
551
+            <element signature="e#453#454#0" expanded="true" />
552
+            <element signature="e#364#365#0" expanded="true" />
553
+            <element signature="e#398#399#0" expanded="true" />
554
+            <element signature="e#622#623#0" expanded="true" />
555
+            <element signature="e#661#662#0" expanded="true" />
556
+            <element signature="e#1071#1072#0" expanded="true" />
557
+            <element signature="e#1108#1109#0" expanded="true" />
558
+            <element signature="e#1048#1049#0" expanded="true" />
559
+            <element signature="e#1075#1076#0" expanded="true" />
560
+            <element signature="e#1646#1647#0" expanded="true" />
561
+            <element signature="e#1683#1684#0" expanded="true" />
562
+          </folding>
563
+        </state>
564
+      </provider>
565
+    </entry>
566
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
567
+      <provider selected="true" editor-type-id="text-editor">
568
+        <state relative-caret-position="281">
569
+          <caret line="39" column="39" lean-forward="true" selection-start-line="39" selection-start-column="39" selection-end-line="39" selection-end-column="39" />
570
+          <folding>
571
+            <element signature="imports" expanded="true" />
572
+          </folding>
573
+        </state>
574
+      </provider>
575
+    </entry>
576
+  </component>
577
+</project>

+ 16
- 0
generics.iml Visa fil

@@ -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>

+ 121
- 0
src/main/java/MyArrayList.java Visa fil

@@ -0,0 +1,121 @@
1
+import java.lang.reflect.Array;
2
+import java.util.Arrays;
3
+
4
+public class MyArrayList<T extends Object> implements MyCollections {
5
+
6
+    private T[] store;
7
+    private int index = 0;
8
+    private int size = 0;
9
+
10
+    public MyArrayList(){
11
+        this.store = (T[])new Object[1];
12
+    }
13
+
14
+    public MyArrayList(int size){
15
+        this.store = (T[])new Object[size + 1];
16
+        this.index = 10;
17
+    }
18
+
19
+    public void add(T object){
20
+        if(index < this.store.length) {
21
+            this.store[index] = object;
22
+            this.size++;
23
+            this.index++;
24
+        } else {
25
+            this.store = increase(this.store);
26
+            this.store[index] = object;
27
+            this.index ++;
28
+
29
+        }
30
+    }
31
+
32
+    public void add(T object, int index){
33
+        while (index >= this.store.length){
34
+            this.store = increase(this.store);
35
+        }
36
+        this.store[index] = object;
37
+
38
+    }
39
+
40
+    public T[] increase(T[] arr){
41
+        int len = arr.length;
42
+        size ++;
43
+        T[] newArr = (T[])new Object[len + 1];
44
+        for(int i = 0; i < arr.length; i ++){
45
+            newArr[i] = arr[i];
46
+        }
47
+        return newArr;
48
+    }
49
+
50
+    public int size(){
51
+        return this.size;
52
+    }
53
+
54
+    public T get(int get){
55
+        return store[get];
56
+    }
57
+
58
+    public void remove(int index) {
59
+        int len = this.store.length;
60
+        size --;
61
+        T[] newArr = (T[])new Object[len - 1];
62
+
63
+        for(int i = 0; i < this.store.length; i ++){
64
+            if(i < index){
65
+                newArr[i] = this.store[i];
66
+            } else if(i > index) {
67
+                newArr[i - 1] = this.store[i];
68
+            }
69
+        }
70
+        this.store = newArr;
71
+    }
72
+
73
+    public void remove(T object){
74
+        for(int i = 0; i < this.store.length; i ++){
75
+            if(this.store[i].equals(object)){
76
+                this.remove(i);
77
+                this.index --;
78
+                break;
79
+            }
80
+        }
81
+    }
82
+
83
+    public void set(T elm, int index){
84
+        this.store[index] = elm;
85
+    }
86
+
87
+    public void clear(){
88
+        this.store = (T[])new Object[1];
89
+        this.size = 0;
90
+    }
91
+
92
+    public boolean isEmpty() {
93
+        return this.size == 0;
94
+    }
95
+
96
+    public boolean contains(T object) {
97
+        if(this.size > 0) {
98
+            for (int i = 0; i < this.store.length; i++) {
99
+                if (this.store[i].equals(object)) {
100
+                    return true;
101
+                }
102
+            }
103
+        }
104
+        return false;
105
+    }
106
+
107
+    public void removeRange(int start, int end) {
108
+        if(end > start) {
109
+            for(int i = start; i <= end; i ++){
110
+                this.remove(i);
111
+            }
112
+        }
113
+    }
114
+
115
+    public T[] toArray(T[] arr){
116
+        for(int i = 0; i < arr.length; i ++){
117
+            arr[i] = this.store[i];
118
+        }
119
+        return arr;
120
+    }
121
+}

+ 5
- 0
src/main/java/MyCollections.java Visa fil

@@ -0,0 +1,5 @@
1
+public interface MyCollections<T extends Object> {
2
+
3
+    int size();
4
+    T get(int i);
5
+}

+ 96
- 0
src/main/java/MyMap.java Visa fil

@@ -0,0 +1,96 @@
1
+public class MyMap <T extends Object, E extends Object> {
2
+
3
+    private MyArrayList<Entry> entries = new MyArrayList<>();
4
+
5
+    public class Entry{
6
+        T key = null;
7
+        E val = null;
8
+
9
+        public Entry(){}
10
+
11
+        public Entry(T key, E value){
12
+            this.key = key;
13
+            this.val = value;
14
+        }
15
+
16
+        public void setKey(T object){
17
+            this.key = (object);
18
+        }
19
+
20
+        public T getKeys(){
21
+            return this.key;
22
+        }
23
+
24
+        public void setVal(E object){
25
+            this.val = (object);
26
+        }
27
+
28
+        public E getVals(){
29
+            return this.val;
30
+        }
31
+
32
+    }
33
+
34
+
35
+    public MyMap(){
36
+
37
+    }
38
+
39
+    public void put(T key, E val) {
40
+        if(!containsKey(key)){
41
+            entries.add(new Entry(key, val));
42
+        } else {
43
+            for(int i = 0; i < entries.size(); i ++){
44
+                if(entries.get(i).getKeys().equals(key)){
45
+                    entries.remove(entries.get(i));
46
+                }
47
+            }
48
+            entries.add(new Entry(key, val));
49
+        }
50
+    }
51
+
52
+    public int size() {
53
+        return entries.size();
54
+    }
55
+
56
+    public E get(T key) {
57
+        for(int i = 0; i < keySet().length; i ++){
58
+            if(keySet()[i].equals(key)){
59
+                return entries.get(i).getVals();
60
+            }
61
+        }
62
+        return null;
63
+    }
64
+
65
+    public void remove(T key) {
66
+        System.out.println(entries.size());
67
+        for(int i = 0; i < entries.size(); i ++){
68
+            if(entries.get(i).getKeys().equals(key)){
69
+                entries.remove(entries.get(i));
70
+            }
71
+        }
72
+    }
73
+
74
+    public boolean containsKey(T key) {
75
+        for(int i = 0; i < entries.size(); i ++){
76
+            System.out.println(entries.get(i).getKeys());
77
+            if(entries.get(i).getKeys().equals(key)){
78
+                return true;
79
+            }
80
+        }
81
+        return false;
82
+    }
83
+
84
+    public T[] keySet() {
85
+        T[] arr = (T[])new Object[getKeyCount()];
86
+
87
+        for(int i = 0; i < entries.size(); i ++){
88
+            arr[i] = entries.get(i).getKeys();
89
+        }
90
+        return arr;
91
+    }
92
+
93
+    private int getKeyCount(){
94
+        return entries.size();
95
+    }
96
+}

+ 61
- 0
src/main/java/MySet.java Visa fil

@@ -0,0 +1,61 @@
1
+public class MySet<T extends Object> implements MyCollections{
2
+
3
+    //private T[] store = (T[])new Object[1];
4
+    private MyArrayList<T> store;
5
+    private int index = 0;
6
+    private int size = 0;
7
+
8
+    public MySet(MyArrayList<T> store2) {
9
+        this.store = store2;
10
+    }
11
+
12
+    public MySet() {
13
+        this.store = new MyArrayList<T>();
14
+    }
15
+
16
+    public boolean add(T item) {
17
+        if(!store.contains(item)) {
18
+            store.add(item);
19
+            return true;
20
+        } else {
21
+            return false;
22
+        }
23
+
24
+    }
25
+
26
+    public boolean contains(T item) {
27
+        if (store.size() > 0) {
28
+            for (int i = 0; i < store.size(); i++) {
29
+                if (store.get(i).equals(item)) {
30
+                    return true;
31
+                }
32
+            }
33
+        }
34
+        return false;
35
+    }
36
+
37
+    public int size(){
38
+        return this.store.size();
39
+    }
40
+
41
+    public void addAll(MyCollections<T> list) {
42
+        for(int i = 0; i < list.size(); i ++){
43
+            this.add(list.get(i));
44
+        }
45
+    }
46
+
47
+    public boolean isEmpty() {
48
+        return this.store.size() == 0;
49
+    }
50
+
51
+    public T[] toArray(T[] arr) {
52
+        for(int i = 0; i < arr.length; i ++){
53
+            arr[i] = this.store.get(i);
54
+        }
55
+        return arr;
56
+    }
57
+
58
+    public T get(int index){
59
+        return this.store.get(index);
60
+    }
61
+}

+ 137
- 0
src/test/java/MyArrayListTest.java Visa fil

@@ -0,0 +1,137 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
4
+import java.util.ArrayList;
5
+
6
+public class MyArrayListTest {
7
+
8
+    @Test
9
+    public void addMethod(){
10
+        MyArrayList<Integer> arrLst = new MyArrayList<>();
11
+        arrLst.add(new Integer(10));
12
+        Assert.assertEquals(1, arrLst.size());
13
+    }
14
+
15
+    @Test
16
+    public void addMethod02(){
17
+        MyArrayList<Integer> arrLst = new MyArrayList<>();
18
+        arrLst.add(5, 3);
19
+        int actual = arrLst.get(3);
20
+        Assert.assertEquals(5, actual);
21
+    }
22
+
23
+    @Test
24
+    public void testConstructor(){
25
+        MyArrayList<Integer> arrLst = new MyArrayList<>(10);
26
+        arrLst.add(10);
27
+        int actual = arrLst.get(10);
28
+        Assert.assertEquals(10, actual);
29
+    }
30
+
31
+    @Test
32
+    public void testRemoveSize(){
33
+        MyArrayList<Integer> arrList = new MyArrayList<>();
34
+        int expect = 0;
35
+        arrList.add(10);
36
+
37
+        arrList.remove(0);
38
+        Assert.assertEquals(expect, arrList.size());
39
+    }
40
+
41
+    @Test(expected = ArrayIndexOutOfBoundsException.class)
42
+    public void testRemoveElem(){
43
+        MyArrayList<Integer> arrList = new MyArrayList<>();
44
+        int expect = 0;
45
+        arrList.add(10);
46
+        int actual = arrList.get(0);
47
+        Assert.assertEquals(10, actual);
48
+        arrList.remove(0);
49
+        actual = arrList.get(0);
50
+    }
51
+
52
+    @Test
53
+    public void testSetElement(){
54
+        MyArrayList<Integer> arrList = new MyArrayList<>(10);
55
+        arrList.add(10, 3);
56
+        int expect = 10;
57
+        int actual = arrList.get(3);
58
+        Assert.assertEquals(expect, actual);
59
+        arrList.set(11, 3);
60
+        expect = 11;
61
+        actual = arrList.get(3);
62
+        Assert.assertEquals(expect, actual);
63
+    }
64
+
65
+    @Test
66
+    public void testClear(){
67
+        MyArrayList<Integer> arrList = new MyArrayList<>();
68
+        for(int i = 0; i < 10; i ++){
69
+            arrList.add(i);
70
+        }
71
+        int expect = 10;
72
+        int actual = arrList.size();
73
+        Assert.assertEquals(expect, actual);
74
+        arrList.clear();
75
+        expect = 0;
76
+        actual = arrList.size();
77
+        Assert.assertEquals(expect, actual);
78
+    }
79
+
80
+    @Test
81
+    public void isEmptyTestPass(){
82
+        MyArrayList<Integer> arrList = new MyArrayList<>();
83
+        Assert.assertTrue(arrList.isEmpty());
84
+    }
85
+
86
+    @Test
87
+    public void isEmptyTestFail(){
88
+        MyArrayList<Integer> arrList = new MyArrayList<>();
89
+        for(int i = 0; i < 10; i ++){
90
+            arrList.add(i);
91
+        }
92
+        Assert.assertFalse(arrList.isEmpty());
93
+    }
94
+
95
+    @Test
96
+    public void containsTestPass(){
97
+        MyArrayList<Integer> arrList = new MyArrayList<>();
98
+        arrList.add(10);
99
+        Assert.assertTrue(arrList.contains(10));
100
+    }
101
+
102
+    @Test
103
+    public void containsTestFail(){
104
+        MyArrayList<Integer> arrList = new MyArrayList<>();
105
+        Assert.assertFalse(arrList.contains(10));
106
+    }
107
+
108
+    @Test
109
+    public void removeRangTest(){
110
+        MyArrayList<Integer> arrList = new MyArrayList<>();
111
+        for(int i = 0; i < 10; i ++){
112
+            arrList.add(i);
113
+        }
114
+        int expect = 10;
115
+        int actual = arrList.size();
116
+        Assert.assertEquals(expect, actual);
117
+        arrList.removeRange(0, 2);
118
+        expect = 7;
119
+        actual = arrList.size();
120
+        Assert.assertEquals(expect, actual);
121
+    }
122
+
123
+    @Test
124
+    public void toArray(){
125
+        MyArrayList<Integer> arrList = new MyArrayList<>();
126
+        arrList.add(10);
127
+        arrList.add(10);
128
+        arrList.add(10);
129
+
130
+        Integer[] temp = arrList.toArray(new Integer[arrList.size()]);
131
+
132
+        int expect = 3;
133
+        int actual = temp.length;
134
+
135
+        Assert.assertEquals(expect, actual);
136
+    }
137
+}

+ 64
- 0
src/test/java/MyMapTest.java Visa fil

@@ -0,0 +1,64 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
4
+import java.util.Arrays;
5
+
6
+public class MyMapTest {
7
+
8
+    @Test
9
+    public void testPut(){
10
+        MyMap<String, String> map = new MyMap<>();
11
+        map.put("jonathan", "hinds");
12
+        Assert.assertTrue(map.size() == 1);
13
+    }
14
+
15
+    @Test
16
+    public void testPutMultiples(){
17
+        MyMap<String, String> map = new MyMap<>();
18
+        map.put("jonathan", "hinds");
19
+        map.put("jonathan", "daniel");
20
+        System.out.println(map.size());
21
+        Assert.assertTrue(map.size() == 1);
22
+    }
23
+
24
+    @Test
25
+    public void testGetMethod(){
26
+        MyMap<String, String> map = new MyMap<>();
27
+        map.put("jonathan", "hinds");
28
+        String expect = "hinds";
29
+        String actual = map.get("jonathan");
30
+        Assert.assertEquals(expect, actual);
31
+    }
32
+
33
+    @Test
34
+    public void testRemove(){
35
+        MyMap<String, String> map = new MyMap<>();
36
+        map.put("jonathan", "hinds");
37
+        map.remove("jonathan");
38
+        System.out.println(map.size());
39
+        Assert.assertTrue(map.size() == 0);
40
+    }
41
+
42
+    @Test
43
+    public void testContainsPass(){
44
+        MyMap<String, String> map = new MyMap<>();
45
+        map.put("jonathan", "hinds");
46
+        Assert.assertTrue(map.containsKey("jonathan"));
47
+    }
48
+
49
+    @Test
50
+    public void testContainsFail(){
51
+        MyMap<String, String> map = new MyMap<>();
52
+        map.put("jonathan", "hinds");
53
+        Assert.assertFalse(map.containsKey("hinds"));
54
+    }
55
+
56
+    @Test
57
+    public void testKeySet(){
58
+        MyMap<String, String> map = new MyMap<>();
59
+        map.put("jonathan", "hinds");
60
+        map.put("someother", "example");
61
+        String[] expect = {"jonathan", "someother"};
62
+        Assert.assertEquals(Arrays.toString(expect), Arrays.toString(map.keySet()));
63
+    }
64
+}

+ 82
- 0
src/test/java/MySetTest.java Visa fil

@@ -0,0 +1,82 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
4
+public class MySetTest {
5
+
6
+    @Test
7
+    public void testAddPass(){
8
+        MySet<Integer> set = new MySet<>();
9
+        Assert.assertTrue(set.add(10));
10
+    }
11
+
12
+    @Test
13
+    public void testAddFail(){
14
+        MySet<Integer> set = new MySet<>();
15
+        set.add(10);
16
+        Assert.assertFalse(set.add(10));
17
+    }
18
+
19
+    @Test
20
+    public void addAllTest(){
21
+        MyArrayList<Integer> list = new MyArrayList<>();
22
+        for(int i = 0; i < 10; i ++){
23
+            list.add(i);
24
+        }
25
+
26
+        MySet<Integer> set = new MySet<Integer>();
27
+        set.addAll(list);
28
+        Assert.assertTrue(set.size() == 10);
29
+    }
30
+
31
+    @Test
32
+    public void addAllDuplicateTest(){
33
+        MyArrayList<Integer> list = new MyArrayList<>();
34
+        for(int i = 0; i < 10; i ++){
35
+            list.add(10);
36
+        }
37
+
38
+        MySet<Integer> set = new MySet<Integer>();
39
+        set.addAll(list);
40
+        Assert.assertTrue(set.size() == 1);
41
+    }
42
+
43
+    @Test
44
+    public void testIsEmptyPass(){
45
+        MySet<Integer> set = new MySet();
46
+        Assert.assertTrue(set.isEmpty());
47
+    }
48
+
49
+    @Test
50
+    public void testIsEmptyFail(){
51
+        MySet<Integer> set = new MySet();
52
+        set.add(10);
53
+        Assert.assertFalse(set.isEmpty());
54
+    }
55
+
56
+    @Test
57
+    public void testToArray(){
58
+        MySet<Integer> set = new MySet<>();
59
+        set.add(10);
60
+        set.add(12);
61
+        Integer[] temp = set.toArray(new Integer[set.size()]);
62
+        int actual = temp.length;
63
+        int expect = 2;
64
+        Assert.assertEquals(expect, actual);
65
+    }
66
+
67
+    @Test
68
+    public void getTest(){
69
+        MySet<Integer> set = new MySet<>();
70
+        set.add(10);
71
+        int expect = 10;
72
+        int actual = set.get(0);
73
+        Assert.assertEquals(expect, actual);
74
+    }
75
+
76
+    @Test
77
+    public void testContains(){
78
+        MySet<Integer> set = new MySet<>();
79
+        set.add(10);
80
+        Assert.assertTrue(set.contains(10));
81
+    }
82
+}