Browse Source

{final submit for now; map needs more work}

Jacqueline Joson 6 years ago
parent
commit
7303b6684f
4 changed files with 274 additions and 147 deletions
  1. 144
    114
      .idea/workspace.xml
  2. 4
    4
      src/main/java/MyArrayList.java
  3. 55
    22
      src/main/java/MyMap.java
  4. 71
    7
      src/test/java/MyMapTest.java

+ 144
- 114
.idea/workspace.xml View File

@@ -2,7 +2,9 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="ada34df4-dfd8-4fb3-8f80-b9a79b2fcc05" name="Default Changelist" comment="">
5
-      <change beforePath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
5
+      <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/src/main/java/MyMap.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyMap.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/src/test/java/MyMapTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
6 8
     </list>
7 9
     <ignored path="$PROJECT_DIR$/target/" />
8 10
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -24,30 +26,30 @@
24 26
           <entry key="JAVA/" value="3" />
25 27
           <entry key="JAVA/MyArrayList" value="1" />
26 28
           <entry key="MODULES/mdl-generics" value="1" />
27
-          <entry key="class" value="4" />
29
+          <entry key="class" value="5" />
28 30
           <entry key="iml" value="1" />
29
-          <entry key="java" value="6" />
31
+          <entry key="java" value="7" />
30 32
           <entry key="md" value="1" />
31 33
         </counts>
32 34
       </usages-collector>
33 35
       <usages-collector id="statistics.file.types.open">
34 36
         <counts>
35
-          <entry key="CLASS" value="4" />
37
+          <entry key="CLASS" value="5" />
36 38
           <entry key="IDEA_MODULE" value="1" />
37
-          <entry key="JAVA" value="6" />
39
+          <entry key="JAVA" value="7" />
38 40
           <entry key="Markdown" value="1" />
39 41
           <entry key="UML" value="5" />
40 42
         </counts>
41 43
       </usages-collector>
42 44
       <usages-collector id="statistics.file.extensions.edit">
43 45
         <counts>
44
-          <entry key="java" value="7861" />
46
+          <entry key="java" value="10524" />
45 47
           <entry key="txt" value="59" />
46 48
         </counts>
47 49
       </usages-collector>
48 50
       <usages-collector id="statistics.file.types.edit">
49 51
         <counts>
50
-          <entry key="JAVA" value="7861" />
52
+          <entry key="JAVA" value="10524" />
51 53
           <entry key="PLAIN_TEXT" value="59" />
52 54
         </counts>
53 55
       </usages-collector>
@@ -58,39 +60,50 @@
58 60
       <file pinned="false" current-in-tab="false">
59 61
         <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
60 62
           <provider selected="true" editor-type-id="text-editor">
61
-            <state relative-caret-position="986">
62
-              <caret line="58" selection-start-line="58" selection-end-line="58" />
63
+            <state relative-caret-position="204">
64
+              <caret line="12" column="32" selection-start-line="12" selection-start-column="32" selection-end-line="12" selection-end-column="32" />
63 65
               <folding>
64 66
                 <element signature="e#67#68#0" expanded="true" />
65 67
                 <element signature="e#107#108#0" expanded="true" />
66
-                <element signature="e#216#217#0" expanded="true" />
67
-                <element signature="e#250#251#0" expanded="true" />
68
-                <element signature="e#1551#1552#0" expanded="true" />
69
-                <element signature="e#1596#1597#0" expanded="true" />
68
+                <element signature="e#215#216#0" expanded="true" />
69
+                <element signature="e#257#258#0" expanded="true" />
70
+                <element signature="e#1770#1771#0" expanded="true" />
71
+                <element signature="e#1804#1805#0" expanded="true" />
70 72
               </folding>
71 73
             </state>
72 74
           </provider>
73 75
         </entry>
74 76
       </file>
75
-      <file pinned="false" current-in-tab="true">
77
+      <file pinned="false" current-in-tab="false">
76 78
         <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
77 79
           <provider selected="true" editor-type-id="text-editor">
78
-            <state relative-caret-position="335">
79
-              <caret line="39" column="21" selection-start-line="39" selection-start-column="21" selection-end-line="39" selection-end-column="21" />
80
+            <state relative-caret-position="272">
81
+              <caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
80 82
               <folding>
81
-                <element signature="e#233#234#0" expanded="true" />
82
-                <element signature="e#266#267#0" expanded="true" />
83
-                <element signature="e#352#353#0" expanded="true" />
84
-                <element signature="e#378#379#0" expanded="true" />
85
-                <element signature="e#417#418#0" expanded="true" />
86
-                <element signature="e#438#439#0" expanded="true" />
87
-                <element signature="e#543#544#0" expanded="true" />
88
-                <element signature="e#570#571#0" expanded="true" />
83
+                <element signature="e#278#279#0" expanded="true" />
84
+                <element signature="e#327#328#0" expanded="true" />
85
+                <element signature="e#178#179#0" expanded="true" />
86
+                <element signature="e#214#215#0" expanded="true" />
87
+                <element signature="e#173#174#0" expanded="true" />
88
+                <element signature="e#200#201#0" expanded="true" />
89
+                <element signature="e#1247#1248#0" expanded="true" />
90
+                <element signature="e#1281#1282#0" expanded="true" />
91
+                <element signature="e#1320#1321#0" expanded="true" />
92
+                <element signature="e#1356#1357#0" expanded="true" />
89 93
               </folding>
90 94
             </state>
91 95
           </provider>
92 96
         </entry>
93 97
       </file>
98
+      <file pinned="false" current-in-tab="true">
99
+        <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
100
+          <provider selected="true" editor-type-id="text-editor">
101
+            <state relative-caret-position="1462">
102
+              <caret line="90" column="8" selection-start-line="90" selection-start-column="8" selection-end-line="90" selection-end-column="8" />
103
+            </state>
104
+          </provider>
105
+        </entry>
106
+      </file>
94 107
       <file pinned="false" current-in-tab="false">
95 108
         <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
96 109
           <provider selected="true" editor-type-id="text-editor">
@@ -119,7 +132,7 @@
119 132
       <file pinned="false" current-in-tab="false">
120 133
         <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
121 134
           <provider selected="true" editor-type-id="text-editor">
122
-            <state relative-caret-position="1411">
135
+            <state relative-caret-position="97">
123 136
               <caret line="83" column="14" lean-forward="true" selection-start-line="83" selection-start-column="14" selection-end-line="83" selection-end-column="14" />
124 137
               <folding>
125 138
                 <element signature="imports" expanded="true" />
@@ -147,21 +160,27 @@
147 160
   <component name="FileTemplateManagerImpl">
148 161
     <option name="RECENT_TEMPLATES">
149 162
       <list>
150
-        <option value="JUnit4 Test Class" />
151 163
         <option value="Class" />
164
+        <option value="JUnit4 Test Class" />
152 165
       </list>
153 166
     </option>
154 167
   </component>
168
+  <component name="FindInProjectRecents">
169
+    <findStrings>
170
+      <find>size</find>
171
+    </findStrings>
172
+  </component>
155 173
   <component name="Git.Settings">
156 174
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
157 175
   </component>
158 176
   <component name="IdeDocumentHistory">
159 177
     <option name="CHANGED_PATHS">
160 178
       <list>
161
-        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
162 179
         <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
163 180
         <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
164 181
         <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
182
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
183
+        <option value="$PROJECT_DIR$/src/test/java/MyMapTest.java" />
165 184
         <option value="$PROJECT_DIR$/src/main/java/MyMap.java" />
166 185
       </list>
167 186
     </option>
@@ -236,7 +255,7 @@
236 255
   <component name="PropertiesComponent">
237 256
     <property name="WebServerToolWindowFactoryState" value="false" />
238 257
     <property name="aspect.path.notification.shown" value="true" />
239
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542421756423" />
258
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542558444322" />
240 259
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
241 260
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit4" value="" />
242 261
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.includeInheritedMembers" value="true" />
@@ -268,65 +287,67 @@
268 287
       </list>
269 288
     </option>
270 289
   </component>
271
-  <component name="RunManager" selected="JUnit.All in generics">
272
-    <configuration name="All in generics" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
290
+  <component name="RunManager" selected="JUnit.MyArrayListTest">
291
+    <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
273 292
       <module name="generics" />
274 293
       <option name="PACKAGE_NAME" value="" />
275
-      <option name="TEST_OBJECT" value="package" />
294
+      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
276 295
       <method v="2">
277 296
         <option name="Make" enabled="true" />
278 297
       </method>
279 298
     </configuration>
280
-    <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299
+    <configuration name="MyMapTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
281 300
       <module name="generics" />
282 301
       <option name="PACKAGE_NAME" value="" />
283
-      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
302
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
284 303
       <method v="2">
285 304
         <option name="Make" enabled="true" />
286 305
       </method>
287 306
     </configuration>
288
-    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
307
+    <configuration name="MyMapTest.add" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
289 308
       <module name="generics" />
290 309
       <option name="PACKAGE_NAME" value="" />
291
-      <option name="MAIN_CLASS_NAME" value="MySetTest" />
310
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
311
+      <option name="METHOD_NAME" value="add" />
312
+      <option name="TEST_OBJECT" value="method" />
292 313
       <method v="2">
293 314
         <option name="Make" enabled="true" />
294 315
       </method>
295 316
     </configuration>
296
-    <configuration name="MySetTest.containsNopeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
317
+    <configuration name="MyMapTest.containsKey" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
297 318
       <module name="generics" />
298 319
       <option name="PACKAGE_NAME" value="" />
299
-      <option name="MAIN_CLASS_NAME" value="MySetTest" />
300
-      <option name="METHOD_NAME" value="containsNopeTest" />
320
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
321
+      <option name="METHOD_NAME" value="containsKey" />
301 322
       <option name="TEST_OBJECT" value="method" />
302 323
       <method v="2">
303 324
         <option name="Make" enabled="true" />
304 325
       </method>
305 326
     </configuration>
306
-    <configuration name="MySetTest.containsTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
327
+    <configuration name="MyMapTest.putTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
307 328
       <module name="generics" />
308 329
       <option name="PACKAGE_NAME" value="" />
309
-      <option name="MAIN_CLASS_NAME" value="MySetTest" />
310
-      <option name="METHOD_NAME" value="containsTest" />
330
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
331
+      <option name="METHOD_NAME" value="putTest" />
311 332
       <option name="TEST_OBJECT" value="method" />
312 333
       <method v="2">
313 334
         <option name="Make" enabled="true" />
314 335
       </method>
315 336
     </configuration>
316 337
     <list>
317
-      <item itemvalue="JUnit.MySetTest.containsTest" />
318
-      <item itemvalue="JUnit.MySetTest.containsNopeTest" />
319
-      <item itemvalue="JUnit.MySetTest" />
338
+      <item itemvalue="JUnit.MyMapTest.containsKey" />
339
+      <item itemvalue="JUnit.MyMapTest.add" />
340
+      <item itemvalue="JUnit.MyMapTest" />
341
+      <item itemvalue="JUnit.MyMapTest.putTest" />
320 342
       <item itemvalue="JUnit.MyArrayListTest" />
321
-      <item itemvalue="JUnit.All in generics" />
322 343
     </list>
323 344
     <recent_temporary>
324 345
       <list>
325
-        <item itemvalue="JUnit.All in generics" />
326 346
         <item itemvalue="JUnit.MyArrayListTest" />
327
-        <item itemvalue="JUnit.MySetTest" />
328
-        <item itemvalue="JUnit.MySetTest.containsNopeTest" />
329
-        <item itemvalue="JUnit.MySetTest.containsTest" />
347
+        <item itemvalue="JUnit.MyMapTest" />
348
+        <item itemvalue="JUnit.MyMapTest.putTest" />
349
+        <item itemvalue="JUnit.MyMapTest.add" />
350
+        <item itemvalue="JUnit.MyMapTest.containsKey" />
330 351
       </list>
331 352
     </recent_temporary>
332 353
   </component>
@@ -340,44 +361,44 @@
340 361
       <option name="number" value="Default" />
341 362
       <option name="presentableId" value="Default" />
342 363
       <updated>1542236797011</updated>
343
-      <workItem from="1542236798436" duration="36911000" />
364
+      <workItem from="1542236798436" duration="46074000" />
344 365
     </task>
345 366
     <servers />
346 367
   </component>
347 368
   <component name="TestHistory">
348
-    <history-entry file="MySetTest_clearTest - 2018.11.16 at 18h 11m 41s.xml">
349
-      <configuration name="MySetTest.clearTest" configurationId="JUnit" />
369
+    <history-entry file="MyMapTest - 2018.11.17 at 21h 57m 46s.xml">
370
+      <configuration name="MyMapTest" configurationId="JUnit" />
350 371
     </history-entry>
351
-    <history-entry file="MySetTest - 2018.11.16 at 18h 12m 08s.xml">
352
-      <configuration name="MySetTest" configurationId="JUnit" />
372
+    <history-entry file="MyMapTest - 2018.11.18 at 10h 53m 08s.xml">
373
+      <configuration name="MyMapTest" configurationId="JUnit" />
353 374
     </history-entry>
354
-    <history-entry file="MySetTest_clearTest - 2018.11.16 at 21h 08m 27s.xml">
355
-      <configuration name="MySetTest.clearTest" configurationId="JUnit" />
375
+    <history-entry file="MyMapTest - 2018.11.18 at 10h 53m 12s.xml">
376
+      <configuration name="MyMapTest" configurationId="JUnit" />
356 377
     </history-entry>
357
-    <history-entry file="MySetTest_isEmptyTest - 2018.11.16 at 21h 10m 48s.xml">
358
-      <configuration name="MySetTest.isEmptyTest" configurationId="JUnit" />
378
+    <history-entry file="MyMapTest - 2018.11.18 at 10h 53m 20s.xml">
379
+      <configuration name="MyMapTest" configurationId="JUnit" />
359 380
     </history-entry>
360
-    <history-entry file="MySetTest_isEmptyTest2 - 2018.11.16 at 21h 11m 58s.xml">
361
-      <configuration name="MySetTest.isEmptyTest2" configurationId="JUnit" />
381
+    <history-entry file="MyMapTest_putTest - 2018.11.18 at 11h 02m 25s.xml">
382
+      <configuration name="MyMapTest.putTest" configurationId="JUnit" />
362 383
     </history-entry>
363
-    <history-entry file="MySetTest_containsTest - 2018.11.16 at 21h 14m 23s.xml">
364
-      <configuration name="MySetTest.containsTest" configurationId="JUnit" />
384
+    <history-entry file="MyMapTest - 2018.11.18 at 11h 02m 28s.xml">
385
+      <configuration name="MyMapTest" configurationId="JUnit" />
365 386
     </history-entry>
366
-    <history-entry file="MySetTest_containsNopeTest - 2018.11.16 at 21h 15m 31s.xml">
367
-      <configuration name="MySetTest.containsNopeTest" configurationId="JUnit" />
387
+    <history-entry file="MyMapTest_putTest - 2018.11.18 at 11h 02m 31s.xml">
388
+      <configuration name="MyMapTest.putTest" configurationId="JUnit" />
368 389
     </history-entry>
369
-    <history-entry file="MySetTest - 2018.11.16 at 21h 15m 51s.xml">
370
-      <configuration name="MySetTest" configurationId="JUnit" />
390
+    <history-entry file="MyMapTest_putTest - 2018.11.18 at 11h 06m 19s.xml">
391
+      <configuration name="MyMapTest.putTest" configurationId="JUnit" />
371 392
     </history-entry>
372
-    <history-entry file="MyArrayListTest - 2018.11.16 at 21h 16m 01s.xml">
373
-      <configuration name="MyArrayListTest" configurationId="JUnit" />
393
+    <history-entry file="MyMapTest_putTest - 2018.11.18 at 11h 09m 00s.xml">
394
+      <configuration name="MyMapTest.putTest" configurationId="JUnit" />
374 395
     </history-entry>
375
-    <history-entry file="All_in_generics - 2018.11.16 at 21h 16m 16s.xml">
376
-      <configuration name="All in generics" configurationId="JUnit" />
396
+    <history-entry file="MyMapTest_putTest - 2018.11.18 at 11h 09m 31s.xml">
397
+      <configuration name="MyMapTest.putTest" configurationId="JUnit" />
377 398
     </history-entry>
378 399
   </component>
379 400
   <component name="TimeTrackingManager">
380
-    <option name="totallyTimeSpent" value="36911000" />
401
+    <option name="totallyTimeSpent" value="46074000" />
381 402
   </component>
382 403
   <component name="ToolWindowManager">
383 404
     <frame x="0" y="23" width="1280" height="712" extended-state="0" />
@@ -439,13 +460,6 @@
439 460
         </state>
440 461
       </provider>
441 462
     </entry>
442
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
443
-      <provider selected="true" editor-type-id="text-editor">
444
-        <state relative-caret-position="221">
445
-          <caret line="16" selection-start-line="16" selection-end-line="16" />
446
-        </state>
447
-      </provider>
448
-    </entry>
449 463
     <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/Assert.class">
450 464
       <provider selected="true" editor-type-id="text-editor">
451 465
         <state relative-caret-position="94">
@@ -540,32 +554,6 @@
540 554
         </state>
541 555
       </provider>
542 556
     </entry>
543
-    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
544
-      <provider selected="true" editor-type-id="text-editor">
545
-        <state relative-caret-position="986">
546
-          <caret line="58" selection-start-line="58" selection-end-line="58" />
547
-          <folding>
548
-            <element signature="e#67#68#0" expanded="true" />
549
-            <element signature="e#107#108#0" expanded="true" />
550
-            <element signature="e#216#217#0" expanded="true" />
551
-            <element signature="e#250#251#0" expanded="true" />
552
-            <element signature="e#1551#1552#0" expanded="true" />
553
-            <element signature="e#1596#1597#0" expanded="true" />
554
-          </folding>
555
-        </state>
556
-      </provider>
557
-    </entry>
558
-    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
559
-      <provider selected="true" editor-type-id="text-editor">
560
-        <state relative-caret-position="1411">
561
-          <caret line="83" column="14" lean-forward="true" selection-start-line="83" selection-start-column="14" selection-end-line="83" selection-end-column="14" />
562
-          <folding>
563
-            <element signature="imports" expanded="true" />
564
-            <element signature="e#210#219#0" expanded="true" />
565
-          </folding>
566
-        </state>
567
-      </provider>
568
-    </entry>
569 557
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
570 558
       <provider selected="true" editor-type-id="text-editor">
571 559
         <state relative-caret-position="34">
@@ -577,6 +565,13 @@
577 565
         </state>
578 566
       </provider>
579 567
     </entry>
568
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
569
+      <provider selected="true" editor-type-id="text-editor">
570
+        <state relative-caret-position="221">
571
+          <caret line="17" selection-start-line="17" selection-end-line="17" />
572
+        </state>
573
+      </provider>
574
+    </entry>
580 575
     <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
581 576
       <provider selected="true" editor-type-id="text-editor">
582 577
         <state relative-caret-position="170">
@@ -600,23 +595,58 @@
600 595
         </state>
601 596
       </provider>
602 597
     </entry>
598
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
599
+      <provider selected="true" editor-type-id="text-editor">
600
+        <state relative-caret-position="97">
601
+          <caret line="83" column="14" lean-forward="true" selection-start-line="83" selection-start-column="14" selection-end-line="83" selection-end-column="14" />
602
+          <folding>
603
+            <element signature="imports" expanded="true" />
604
+            <element signature="e#210#219#0" expanded="true" />
605
+          </folding>
606
+        </state>
607
+      </provider>
608
+    </entry>
609
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
610
+      <provider selected="true" editor-type-id="text-editor">
611
+        <state relative-caret-position="204">
612
+          <caret line="12" column="32" selection-start-line="12" selection-start-column="32" selection-end-line="12" selection-end-column="32" />
613
+          <folding>
614
+            <element signature="e#67#68#0" expanded="true" />
615
+            <element signature="e#107#108#0" expanded="true" />
616
+            <element signature="e#215#216#0" expanded="true" />
617
+            <element signature="e#257#258#0" expanded="true" />
618
+            <element signature="e#1770#1771#0" expanded="true" />
619
+            <element signature="e#1804#1805#0" expanded="true" />
620
+          </folding>
621
+        </state>
622
+      </provider>
623
+    </entry>
603 624
     <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
604 625
       <provider selected="true" editor-type-id="text-editor">
605
-        <state relative-caret-position="335">
606
-          <caret line="39" column="21" selection-start-line="39" selection-start-column="21" selection-end-line="39" selection-end-column="21" />
626
+        <state relative-caret-position="272">
627
+          <caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
607 628
           <folding>
608
-            <element signature="e#233#234#0" expanded="true" />
609
-            <element signature="e#266#267#0" expanded="true" />
610
-            <element signature="e#352#353#0" expanded="true" />
611
-            <element signature="e#378#379#0" expanded="true" />
612
-            <element signature="e#417#418#0" expanded="true" />
613
-            <element signature="e#438#439#0" expanded="true" />
614
-            <element signature="e#543#544#0" expanded="true" />
615
-            <element signature="e#570#571#0" expanded="true" />
629
+            <element signature="e#278#279#0" expanded="true" />
630
+            <element signature="e#327#328#0" expanded="true" />
631
+            <element signature="e#178#179#0" expanded="true" />
632
+            <element signature="e#214#215#0" expanded="true" />
633
+            <element signature="e#173#174#0" expanded="true" />
634
+            <element signature="e#200#201#0" expanded="true" />
635
+            <element signature="e#1247#1248#0" expanded="true" />
636
+            <element signature="e#1281#1282#0" expanded="true" />
637
+            <element signature="e#1320#1321#0" expanded="true" />
638
+            <element signature="e#1356#1357#0" expanded="true" />
616 639
           </folding>
617 640
         </state>
618 641
       </provider>
619 642
     </entry>
643
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
644
+      <provider selected="true" editor-type-id="text-editor">
645
+        <state relative-caret-position="1462">
646
+          <caret line="90" column="8" selection-start-line="90" selection-start-column="8" selection-end-line="90" selection-end-column="8" />
647
+        </state>
648
+      </provider>
649
+    </entry>
620 650
   </component>
621 651
   <component name="masterDetails">
622 652
     <states>

+ 4
- 4
src/main/java/MyArrayList.java View File

@@ -9,8 +9,8 @@ public class MyArrayList<T> {
9 9
 
10 10
     public MyArrayList() {}
11 11
 
12
-    public MyArrayList(int index) {
13
-        this.index = index;
12
+    public MyArrayList(int size) {
13
+        this.theArray = (T[]) new Object[size];
14 14
     }
15 15
 
16 16
         public void add(T elementToAdd){
@@ -64,8 +64,8 @@ public class MyArrayList<T> {
64 64
             return false;
65 65
         }
66 66
 
67
-        public int size() {
68
-           return theArray.length;
67
+        public Integer size() {
68
+            return this.theArray.length;
69 69
         }
70 70
 
71 71
 

+ 55
- 22
src/main/java/MyMap.java View File

@@ -1,44 +1,77 @@
1
-public class MyMap <K, V> {
2 1
 
3
-    private K [] key;
4
-    private V [] value;
5
-    private int index;
2
+public class MyMap <K, V> {
6 3
 
4
+    private MyArrayList<Entry> entries;
7 5
 
8
-    public MyMap(K[] key, V[] value) {
9
-        this.key = key;
10
-        this.value = value;
6
+    public MyMap() {
7
+        entries = new MyArrayList<>();
11 8
     }
12
-    public MyMap() {}
13 9
 
14
-    public MyMap(int index) {
15
-        this.index = index;
10
+    public Integer size() {
11
+        return entries.size();
16 12
     }
17 13
 
18 14
     public void clear() {
19
-
15
+        this.entries.clear();
20 16
     }
21 17
 
22
-    public boolean containsKey(V value) {
23
-        return true;
18
+    public boolean containsKey(K key) {
19
+        for (int i = 0; i < entries.size(); i++) {
20
+            if (entries.get(i).getKey().equals(key)) {
21
+                return true;
22
+            }
23
+        }
24
+        return false;
24 25
     }
25 26
 
26
-    public boolean containsValue(K key) {
27
-        return true;
27
+
28
+    public boolean containsValue(V value) {
29
+        for (int i = 0; i < entries.size(); i++) {
30
+            if (entries.get(i).getValue().equals(value)) {
31
+                return true;
32
+            }
33
+        }
34
+        return false;
28 35
     }
29 36
 
30
-    public V get(K key) {
37
+    public Object get(K key) {
38
+        for (int i = 0; i < entries.size(); i++) {
39
+            if (entries.get(i).getKey().equals(key)) {
40
+                return entries.get(i).getValue();
41
+            }
42
+        }
31 43
         return null;
32
-        return V;
33 44
     }
34 45
 
35
-    public boolean isEmpty() {
36
-        return true;
37
-    }
38 46
 
39
-    public void add(K key, V value) {
40
-        //put method
47
+    public void put(K key, V value) {
48
+        //add method
49
+        for (int i = 0; i < entries.size(); i++) {
50
+            if(entries.get(i).getKey().equals(key)) {
51
+                entries.set(i, new Entry<>(key, value));
52
+                break;
53
+            }
54
+        }
55
+        entries.add(new Entry<>(key, value));
41 56
     }
42 57
 
43 58
 
59
+    private  class Entry <K, V> {
60
+        private K key;
61
+        private V value;
62
+
63
+        public Entry(K key, V value) {
64
+            this.key = key;
65
+            this.value = value;
66
+        }
67
+
68
+        public K getKey() {
69
+            return key;
70
+        }
71
+
72
+        public V getValue() {
73
+            return value;
74
+        }
75
+    }
76
+
44 77
 }

+ 71
- 7
src/test/java/MyMapTest.java View File

@@ -1,30 +1,94 @@
1
+import org.junit.Assert;
1 2
 import org.junit.Test;
2 3
 
3
-import static org.junit.Assert.*;
4 4
 
5 5
 public class MyMapTest {
6
+    // I know why it's failing but I don't know how to fix it, so I'm going to move on for now and hopefully
7
+    //come back once I've been struck by genius
8
+
9
+    //SetUp
10
+    //Integer [] key = {1, 2, 3, 4, 5};
11
+    //String [] value = {"One", "Two", "Three", "Four", "Five"};
12
+    //String [] wordKey = {"I", "love", "weekends"};
13
+    //String [] wordValue = {"You", "hate", "weekdays"};
14
+    MyMap<Integer, String> myMap = new MyMap<>();
6 15
 
7 16
     @Test
8
-    public void clear() {
17
+    public void clearTest() {
18
+        //given
19
+
20
+        MyMap<String, Integer> myFamTest = new MyMap<>();
21
+        myFamTest.put("Nicole", 26);
22
+        myFamTest.put("Arpita", 26);
23
+        myFamTest.put("Chris", 24);
24
+        Object expected = null;
25
+
26
+        //when
27
+        myFamTest.clear();
28
+        Object actual = myFamTest.get("Josh");
29
+
30
+        //then
31
+        Assert.assertNull(actual);
9 32
     }
10 33
 
11 34
     @Test
12
-    public void containsKey() {
35
+    public void containsKeyTest() {
36
+        //given
37
+        MyMap<String, Integer> myMap = new MyMap<>();
38
+        myMap.put("Josh", 21);
39
+        boolean expected = true;
40
+
41
+        //when
42
+        boolean actual = myMap.containsKey("Josh");
43
+
44
+        //then
45
+        Assert.assertTrue(actual);
46
+
13 47
     }
14 48
 
15 49
     @Test
16
-    public void containsValue() {
50
+    public void containsValueTest() {
51
+        //given
52
+        MyMap<String, Integer> myPeeps = new MyMap<>();
53
+        myPeeps.put("Jordan", 19);
54
+        boolean expected = true;
55
+
56
+        //when
57
+        boolean actual = myPeeps.containsValue(19);
58
+
59
+        //then
60
+        Assert.assertEquals(expected, actual);
17 61
     }
18 62
 
19 63
     @Test
20
-    public void get() {
64
+    public void getTest() {
65
+        //given
66
+        MyMap<String, Integer> myMapTest = new MyMap<>();
67
+        Object expected = null;
68
+
69
+        //when
70
+        Object actual = myMapTest.get("Yo");
71
+
72
+        //then
73
+        Assert.assertEquals(expected, actual);
21 74
     }
22 75
 
76
+
23 77
     @Test
24
-    public void isEmpty() {
78
+    public void putTest() {
79
+        //given
80
+        MyMap<String, Integer> myMapTest = new MyMap<>();
81
+        Object expected = 1;
82
+
83
+        //when
84
+        myMapTest.put("Hello", 1);
85
+        Object actual = myMapTest.get("Hello");
86
+        //then
87
+        Assert.assertEquals(expected, actual);
25 88
     }
26 89
 
27 90
     @Test
28
-    public void add() {
91
+    public void sizeTest() {
92
+
29 93
     }
30 94
 }