Browse Source

Done part 3

Lauren Green 6 years ago
parent
commit
49e89a9ab6
5 changed files with 199 additions and 94 deletions
  1. 92
    85
      .idea/workspace.xml
  2. 1
    1
      src/main/java/Entry.java
  3. 53
    8
      src/main/java/MyMap.java
  4. 2
    0
      src/main/java/MySet.java
  5. 51
    0
      src/test/java/MyMapTest.java

+ 92
- 85
.idea/workspace.xml View File

@@ -2,11 +2,10 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="83830738-28db-4c65-8a38-09ae1bf50ffe" name="Default Changelist" comment="">
5
-      <change afterPath="$PROJECT_DIR$/src/main/java/Entry.java" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/src/main/java/MyMap.java" afterDir="false" />
7
-      <change afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
8
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
5
+      <change beforePath="$PROJECT_DIR$/src/main/java/Entry.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Entry.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/main/java/MySet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/src/test/java/MyMapTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
10 9
     </list>
11 10
     <ignored path="$PROJECT_DIR$/target/" />
12 11
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -17,11 +16,12 @@
17 16
   </component>
18 17
   <component name="CoverageDataManager">
19 18
     <SUITE FILE_PATH="coverage/generics$MyArrayListTest.ic" NAME="MyArrayListTest Coverage Results" MODIFIED="1542144019155" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
19
+    <SUITE FILE_PATH="coverage/generics$MyMapTest.ic" NAME="MyMapTest Coverage Results" MODIFIED="1542150510047" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
20 20
     <SUITE FILE_PATH="coverage/generics$MyArrayListTest_testContainsOfEmptyArray.ic" NAME="MyArrayListTest.testContainsOfEmptyArray Coverage Results" MODIFIED="1542141601234" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
21 21
     <SUITE FILE_PATH="coverage/generics$MySetTest.ic" NAME="MySetTest Coverage Results" MODIFIED="1542143972716" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
22 22
   </component>
23 23
   <component name="CoverageViewManager">
24
-    <option name="myElementSize" value="253" />
24
+    <option name="myElementSize" value="256" />
25 25
   </component>
26 26
   <component name="FUSProjectUsageTrigger">
27 27
     <session id="1662657773">
@@ -34,23 +34,23 @@
34 34
       <usages-collector id="statistics.file.extensions.open">
35 35
         <counts>
36 36
           <entry key="gitignore" value="1" />
37
-          <entry key="java" value="18" />
37
+          <entry key="java" value="20" />
38 38
         </counts>
39 39
       </usages-collector>
40 40
       <usages-collector id="statistics.file.types.open">
41 41
         <counts>
42
-          <entry key="JAVA" value="18" />
42
+          <entry key="JAVA" value="20" />
43 43
           <entry key="PLAIN_TEXT" value="1" />
44 44
         </counts>
45 45
       </usages-collector>
46 46
       <usages-collector id="statistics.file.extensions.edit">
47 47
         <counts>
48
-          <entry key="java" value="4372" />
48
+          <entry key="java" value="5489" />
49 49
         </counts>
50 50
       </usages-collector>
51 51
       <usages-collector id="statistics.file.types.edit">
52 52
         <counts>
53
-          <entry key="JAVA" value="4372" />
53
+          <entry key="JAVA" value="5489" />
54 54
         </counts>
55 55
       </usages-collector>
56 56
     </session>
@@ -62,8 +62,8 @@
62 62
           <file pinned="false" current-in-tab="false">
63 63
             <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
64 64
               <provider selected="true" editor-type-id="text-editor">
65
-                <state relative-caret-position="240">
66
-                  <caret line="16" column="21" lean-forward="true" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
65
+                <state relative-caret-position="-659">
66
+                  <caret line="34" column="34" selection-start-line="34" selection-start-column="34" selection-end-line="34" selection-end-column="34" />
67 67
                   <folding>
68 68
                     <element signature="e#258#259#0" expanded="true" />
69 69
                     <element signature="e#286#287#0" expanded="true" />
@@ -81,8 +81,8 @@
81 81
           <file pinned="false" current-in-tab="true">
82 82
             <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
83 83
               <provider selected="true" editor-type-id="text-editor">
84
-                <state relative-caret-position="178">
85
-                  <caret line="33" selection-start-line="33" selection-end-line="33" />
84
+                <state relative-caret-position="262">
85
+                  <caret line="91" column="4" selection-start-line="91" selection-start-column="4" selection-end-line="91" selection-end-column="4" />
86 86
                   <folding>
87 87
                     <element signature="e#110#111#0" expanded="true" />
88 88
                     <element signature="e#137#138#0" expanded="true" />
@@ -94,8 +94,8 @@
94 94
           <file pinned="false" current-in-tab="false">
95 95
             <entry file="file://$PROJECT_DIR$/src/main/java/Entry.java">
96 96
               <provider selected="true" editor-type-id="text-editor">
97
-                <state relative-caret-position="255">
98
-                  <caret line="17" column="11" selection-start-line="17" selection-start-column="11" selection-end-line="17" selection-end-column="11" />
97
+                <state relative-caret-position="180">
98
+                  <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
99 99
                   <folding>
100 100
                     <element signature="e#169#170#0" expanded="true" />
101 101
                     <element signature="e#195#196#0" expanded="true" />
@@ -110,6 +110,15 @@
110 110
               </provider>
111 111
             </entry>
112 112
           </file>
113
+          <file pinned="false" current-in-tab="false">
114
+            <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
115
+              <provider selected="true" editor-type-id="text-editor">
116
+                <state relative-caret-position="533">
117
+                  <caret line="39" selection-start-line="39" selection-end-line="39" />
118
+                </state>
119
+              </provider>
120
+            </entry>
121
+          </file>
113 122
         </leaf>
114 123
       </split-first>
115 124
       <split-second>
@@ -117,8 +126,8 @@
117 126
           <file pinned="false" current-in-tab="true">
118 127
             <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
119 128
               <provider selected="true" editor-type-id="text-editor">
120
-                <state relative-caret-position="264">
121
-                  <caret line="70" column="46" lean-forward="true" selection-start-line="70" selection-start-column="46" selection-end-line="70" selection-end-column="46" />
129
+                <state relative-caret-position="504">
130
+                  <caret line="127" column="34" selection-start-line="127" selection-start-column="34" selection-end-line="127" selection-end-column="34" />
122 131
                   <folding>
123 132
                     <element signature="imports" expanded="true" />
124 133
                   </folding>
@@ -169,12 +178,12 @@
169 178
       <list>
170 179
         <option value="$PROJECT_DIR$/src/main/java/Node.java" />
171 180
         <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
172
-        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
173 181
         <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
174
-        <option value="$PROJECT_DIR$/src/test/java/MyMapTest.java" />
182
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
183
+        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
175 184
         <option value="$PROJECT_DIR$/src/main/java/Entry.java" />
185
+        <option value="$PROJECT_DIR$/src/test/java/MyMapTest.java" />
176 186
         <option value="$PROJECT_DIR$/src/main/java/MyMap.java" />
177
-        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
178 187
       </list>
179 188
     </option>
180 189
   </component>
@@ -245,7 +254,7 @@
245 254
   <component name="PropertiesComponent">
246 255
     <property name="WebServerToolWindowFactoryState" value="false" />
247 256
     <property name="aspect.path.notification.shown" value="true" />
248
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542148562422" />
257
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542151686248" />
249 258
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
250 259
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
251 260
   </component>
@@ -266,69 +275,67 @@
266 275
       </list>
267 276
     </option>
268 277
   </component>
269
-  <component name="RunManager" selected="JUnit.MyMapTest.testContainsValue">
270
-    <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
278
+  <component name="RunManager" selected="JUnit.MyMapTest.testRemoveByKey">
279
+    <configuration name="All in generics" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
271 280
       <module name="generics" />
272 281
       <option name="PACKAGE_NAME" value="" />
273
-      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
282
+      <option name="TEST_OBJECT" value="package" />
274 283
       <method v="2">
275 284
         <option name="Make" enabled="true" />
276 285
       </method>
277 286
     </configuration>
278
-    <configuration name="MyMapTest.testClear" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
287
+    <configuration name="MyMapTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
279 288
       <module name="generics" />
280 289
       <option name="PACKAGE_NAME" value="" />
281 290
       <option name="MAIN_CLASS_NAME" value="MyMapTest" />
282
-      <option name="METHOD_NAME" value="testClear" />
283
-      <option name="TEST_OBJECT" value="method" />
284 291
       <method v="2">
285 292
         <option name="Make" enabled="true" />
286 293
       </method>
287 294
     </configuration>
288
-    <configuration name="MyMapTest.testContainsKey" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
295
+    <configuration name="MyMapTest.testPutAll" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
289 296
       <module name="generics" />
290 297
       <option name="PACKAGE_NAME" value="" />
291 298
       <option name="MAIN_CLASS_NAME" value="MyMapTest" />
292
-      <option name="METHOD_NAME" value="testContainsKey" />
299
+      <option name="METHOD_NAME" value="testPutAll" />
293 300
       <option name="TEST_OBJECT" value="method" />
294 301
       <method v="2">
295 302
         <option name="Make" enabled="true" />
296 303
       </method>
297 304
     </configuration>
298
-    <configuration name="MyMapTest.testContainsValue" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
305
+    <configuration name="MyMapTest.testRemove" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299 306
       <module name="generics" />
300 307
       <option name="PACKAGE_NAME" value="" />
301 308
       <option name="MAIN_CLASS_NAME" value="MyMapTest" />
302
-      <option name="METHOD_NAME" value="testContainsValue" />
309
+      <option name="METHOD_NAME" value="testRemove" />
303 310
       <option name="TEST_OBJECT" value="method" />
304 311
       <method v="2">
305 312
         <option name="Make" enabled="true" />
306 313
       </method>
307 314
     </configuration>
308
-    <configuration name="MyMapTest.testSize2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
315
+    <configuration name="MyMapTest.testRemoveByKey" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309 316
       <module name="generics" />
310 317
       <option name="PACKAGE_NAME" value="" />
311 318
       <option name="MAIN_CLASS_NAME" value="MyMapTest" />
312
-      <option name="METHOD_NAME" value="testSize2" />
319
+      <option name="METHOD_NAME" value="testRemoveByKey" />
313 320
       <option name="TEST_OBJECT" value="method" />
314 321
       <method v="2">
315 322
         <option name="Make" enabled="true" />
316 323
       </method>
317 324
     </configuration>
318 325
     <list>
319
-      <item itemvalue="JUnit.MyMapTest.testSize2" />
320
-      <item itemvalue="JUnit.MyMapTest.testClear" />
321
-      <item itemvalue="JUnit.MyArrayListTest" />
322
-      <item itemvalue="JUnit.MyMapTest.testContainsKey" />
323
-      <item itemvalue="JUnit.MyMapTest.testContainsValue" />
326
+      <item itemvalue="JUnit.MyMapTest" />
327
+      <item itemvalue="JUnit.MyMapTest.testPutAll" />
328
+      <item itemvalue="JUnit.MyMapTest.testRemove" />
329
+      <item itemvalue="JUnit.MyMapTest.testRemoveByKey" />
330
+      <item itemvalue="JUnit.All in generics" />
324 331
     </list>
325 332
     <recent_temporary>
326 333
       <list>
327
-        <item itemvalue="JUnit.MyMapTest.testContainsValue" />
328
-        <item itemvalue="JUnit.MyMapTest.testContainsKey" />
329
-        <item itemvalue="JUnit.MyMapTest.testClear" />
330
-        <item itemvalue="JUnit.MyMapTest.testSize2" />
331
-        <item itemvalue="JUnit.MyArrayListTest" />
334
+        <item itemvalue="JUnit.MyMapTest.testRemoveByKey" />
335
+        <item itemvalue="JUnit.All in generics" />
336
+        <item itemvalue="JUnit.MyMapTest" />
337
+        <item itemvalue="JUnit.MyMapTest.testRemove" />
338
+        <item itemvalue="JUnit.MyMapTest.testPutAll" />
332 339
       </list>
333 340
     </recent_temporary>
334 341
   </component>
@@ -342,44 +349,44 @@
342 349
       <option name="number" value="Default" />
343 350
       <option name="presentableId" value="Default" />
344 351
       <updated>1542134351966</updated>
345
-      <workItem from="1542134355138" duration="14057000" />
352
+      <workItem from="1542134355138" duration="16962000" />
346 353
     </task>
347 354
     <servers />
348 355
   </component>
349 356
   <component name="TestHistory">
350
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 17m 25s.xml">
351
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
357
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 22m 10s.xml">
358
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
352 359
     </history-entry>
353
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 17m 43s.xml">
354
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
360
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 22m 44s.xml">
361
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
355 362
     </history-entry>
356
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 18m 22s.xml">
357
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
363
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 22m 55s.xml">
364
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
358 365
     </history-entry>
359
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 19m 34s.xml">
360
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
366
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 23m 42s.xml">
367
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
361 368
     </history-entry>
362
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 19m 56s.xml">
363
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
369
+    <history-entry file="MyMapTest - 2018.11.13 at 18h 23m 52s.xml">
370
+      <configuration name="MyMapTest" configurationId="JUnit" />
364 371
     </history-entry>
365
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 21m 24s.xml">
366
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
372
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 24m 13s.xml">
373
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
367 374
     </history-entry>
368
-    <history-entry file="MyMapTest_testContainsKey - 2018.11.13 at 17h 22m 05s.xml">
369
-      <configuration name="MyMapTest.testContainsKey" configurationId="JUnit" />
375
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 24m 32s.xml">
376
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
370 377
     </history-entry>
371
-    <history-entry file="MyMapTest_testContainsValue - 2018.11.13 at 17h 30m 21s.xml">
372
-      <configuration name="MyMapTest.testContainsValue" configurationId="JUnit" />
378
+    <history-entry file="MyMapTest_testRemoveByKey - 2018.11.13 at 18h 25m 39s.xml">
379
+      <configuration name="MyMapTest.testRemoveByKey" configurationId="JUnit" />
373 380
     </history-entry>
374
-    <history-entry file="MyMapTest_testContainsValue - 2018.11.13 at 17h 35m 11s.xml">
375
-      <configuration name="MyMapTest.testContainsValue" configurationId="JUnit" />
381
+    <history-entry file="MyMapTest - 2018.11.13 at 18h 25m 51s.xml">
382
+      <configuration name="MyMapTest" configurationId="JUnit" />
376 383
     </history-entry>
377
-    <history-entry file="MyMapTest_testContainsValue - 2018.11.13 at 17h 36m 06s.xml">
378
-      <configuration name="MyMapTest.testContainsValue" configurationId="JUnit" />
384
+    <history-entry file="All_in_generics - 2018.11.13 at 18h 25m 58s.xml">
385
+      <configuration name="All in generics" configurationId="JUnit" />
379 386
     </history-entry>
380 387
   </component>
381 388
   <component name="TimeTrackingManager">
382
-    <option name="totallyTimeSpent" value="14057000" />
389
+    <option name="totallyTimeSpent" value="16962000" />
383 390
   </component>
384 391
   <component name="ToolWindowManager">
385 392
     <frame x="36" y="23" width="1621" height="958" extended-state="0" />
@@ -443,13 +450,6 @@
443 450
         </state>
444 451
       </provider>
445 452
     </entry>
446
-    <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
447
-      <provider selected="true" editor-type-id="text-editor">
448
-        <state relative-caret-position="66">
449
-          <caret line="5" column="16" selection-start-line="5" selection-start-column="16" selection-end-line="5" selection-end-column="16" />
450
-        </state>
451
-      </provider>
452
-    </entry>
453 453
     <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
454 454
       <provider selected="true" editor-type-id="text-editor">
455 455
         <state relative-caret-position="855">
@@ -472,8 +472,8 @@
472 472
     </entry>
473 473
     <entry file="file://$PROJECT_DIR$/src/main/java/Entry.java">
474 474
       <provider selected="true" editor-type-id="text-editor">
475
-        <state relative-caret-position="255">
476
-          <caret line="17" column="11" selection-start-line="17" selection-start-column="11" selection-end-line="17" selection-end-column="11" />
475
+        <state relative-caret-position="180">
476
+          <caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
477 477
           <folding>
478 478
             <element signature="e#169#170#0" expanded="true" />
479 479
             <element signature="e#195#196#0" expanded="true" />
@@ -487,20 +487,17 @@
487 487
         </state>
488 488
       </provider>
489 489
     </entry>
490
-    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
490
+    <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
491 491
       <provider selected="true" editor-type-id="text-editor">
492
-        <state relative-caret-position="264">
493
-          <caret line="70" column="46" lean-forward="true" selection-start-line="70" selection-start-column="46" selection-end-line="70" selection-end-column="46" />
494
-          <folding>
495
-            <element signature="imports" expanded="true" />
496
-          </folding>
492
+        <state relative-caret-position="533">
493
+          <caret line="39" selection-start-line="39" selection-end-line="39" />
497 494
         </state>
498 495
       </provider>
499 496
     </entry>
500 497
     <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
501 498
       <provider selected="true" editor-type-id="text-editor">
502
-        <state relative-caret-position="240">
503
-          <caret line="16" column="21" lean-forward="true" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
499
+        <state relative-caret-position="-659">
500
+          <caret line="34" column="34" selection-start-line="34" selection-start-column="34" selection-end-line="34" selection-end-column="34" />
504 501
           <folding>
505 502
             <element signature="e#258#259#0" expanded="true" />
506 503
             <element signature="e#286#287#0" expanded="true" />
@@ -514,10 +511,20 @@
514 511
         </state>
515 512
       </provider>
516 513
     </entry>
514
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
515
+      <provider selected="true" editor-type-id="text-editor">
516
+        <state relative-caret-position="504">
517
+          <caret line="127" column="34" selection-start-line="127" selection-start-column="34" selection-end-line="127" selection-end-column="34" />
518
+          <folding>
519
+            <element signature="imports" expanded="true" />
520
+          </folding>
521
+        </state>
522
+      </provider>
523
+    </entry>
517 524
     <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
518 525
       <provider selected="true" editor-type-id="text-editor">
519
-        <state relative-caret-position="178">
520
-          <caret line="33" selection-start-line="33" selection-end-line="33" />
526
+        <state relative-caret-position="262">
527
+          <caret line="91" column="4" selection-start-line="91" selection-start-column="4" selection-end-line="91" selection-end-column="4" />
521 528
           <folding>
522 529
             <element signature="e#110#111#0" expanded="true" />
523 530
             <element signature="e#137#138#0" expanded="true" />

+ 1
- 1
src/main/java/Entry.java View File

@@ -1,4 +1,4 @@
1
-public class Entry<K, V> {
1
+public class Entry<K, V> extends Object{
2 2
     K key;
3 3
     V value;
4 4
 

+ 53
- 8
src/main/java/MyMap.java View File

@@ -17,7 +17,9 @@ public class MyMap<K, V> extends MyArrayList<Entry>{
17 17
         if (getSize() == 0) {
18 18
             return false;
19 19
         } else {
20
-            for (Entry entry : getArray()) {
20
+            Object[] entries = getArray();
21
+            for (int i = 0; i < entries.length; i++) {
22
+                Entry entry = (Entry) entries[i];
21 23
                 if (entry.getKey().equals(key)) {
22 24
                     return true;
23 25
                 }
@@ -31,10 +33,10 @@ public class MyMap<K, V> extends MyArrayList<Entry>{
31 33
         if (getSize() == 0) {
32 34
             return false;
33 35
         } else {
34
-            Entry[] thisArray = (Entry[]) getArray();
35
-            for (Entry entry : thisArray) {
36
-                V thisValue = (V) entry.getValue();
37
-                if (thisValue.equals(value)) {
36
+            Object[] entries = getArray();
37
+            for (int i = 0; i < entries.length; i++) {
38
+                Entry entry = (Entry) entries[i];
39
+                if (entry.getValue().equals(value)) {
38 40
                     return true;
39 41
                 }
40 42
             }
@@ -46,12 +48,55 @@ public class MyMap<K, V> extends MyArrayList<Entry>{
46 48
         if (getSize() == 0) {
47 49
             return null;
48 50
         } else {
49
-            for (Entry entry : getArray()) {
50
-                if (entry.getKey().equals(key)) {
51
-                    return (V) entry.getValue();
51
+            Object[] entries = getArray();
52
+            for (int i = 0; i < entries.length; i++) {
53
+                Entry entry = (Entry) entries[i];
54
+                try {
55
+                    if (entry.getKey().equals(key)) {
56
+                        return (V) entry.getValue();
57
+                    }
58
+                } catch (NullPointerException e) {
59
+                    return null;
52 60
                 }
53 61
             }
54 62
         }
55 63
         return null;
56 64
     }
65
+
66
+    public MySet<K> keySet() {
67
+        MySet<K> keys = new MySet<>();
68
+        Object[] entries = getArray();
69
+        for (int i = 0; i < entries.length; i++) {
70
+            Entry entry = (Entry) entries[i];
71
+            keys.add((K) entry.getKey());
72
+        }
73
+        return keys;
74
+    }
75
+
76
+    public MyArrayList<V> values() {
77
+        MyArrayList<V> values = new MyArrayList<>();
78
+        Object[] entries = getArray();
79
+        for (int i = 0; i < entries.length; i++) {
80
+            Entry entry = (Entry) entries[i];
81
+            values.add((V) entry.getValue());
82
+        }
83
+        return values;
84
+    }
85
+
86
+    public void putAll(Entry[] entries) {
87
+        for(Entry entry : entries) {
88
+            put((K) entry.getKey(), (V) entry.getValue());
89
+        }
90
+    }
91
+
92
+
93
+    public void removeByKey(K key) {
94
+        Object[] entries = getArray();
95
+        for (int i = 0; i < entries.length; i++) {
96
+            Entry entry = (Entry) entries[i];
97
+            if (entry.getKey().equals(key)) {
98
+                remove(entry);
99
+            }
100
+        }
101
+    }
57 102
 }

+ 2
- 0
src/main/java/MySet.java View File

@@ -36,4 +36,6 @@ public class MySet<T> extends MyArrayList<T> {
36 36
     public Object[] toArray(){
37 37
         return getArray();
38 38
     }
39
+
40
+
39 41
 }

+ 51
- 0
src/test/java/MyMapTest.java View File

@@ -73,10 +73,61 @@ public class MyMapTest {
73 73
     }
74 74
 
75 75
     @Test
76
+    public void testKeySet() {
77
+        MyMap<Integer, String> map1 = new MyMap<>();
78
+        map1.put(numb1, str1);
79
+        MySet<Integer> keySet = new MySet<>();
80
+        keySet.add(numb1);
81
+        MySet<Integer> expected = keySet;
82
+        MySet<Integer> actual = map1.keySet();
83
+
84
+        Assert.assertArrayEquals(expected.getArray(), actual.getArray());
85
+
86
+    }
87
+
88
+    @Test
89
+    public void testValues() {
90
+        MyMap<Integer, String> map1 = new MyMap<>();
91
+        map1.put(numb1, str1);
92
+        MyArrayList<String> values = new MyArrayList<>();
93
+        values.add(str1);
94
+        MyArrayList<String> expected = values;
95
+        MyArrayList<String> actual = map1.values();
96
+
97
+        Assert.assertArrayEquals(expected.getArray(), actual.getArray());
98
+
99
+    }
100
+
101
+    @Test
76 102
     public void testIsEmpty() {
77 103
         MyMap<Integer, String> map1 = new MyMap<>();
78 104
 
79 105
         Assert.assertTrue(map1.isEmpty());
80 106
     }
107
+
108
+    @Test
109
+    public void testPutAll() {
110
+        MyMap<Integer, String> map1 = new MyMap<>();
111
+        Entry<Integer, String> entry1 = new Entry<>(numb1, str1);
112
+        Entry<Integer, String> entry2 = new Entry<>(numb2, str2);
113
+        Entry<Integer, String> entry3 = new Entry<>(numb3, str3);
114
+        Entry[] entries = {entry1, entry2, entry3};
115
+        map1.putAll(entries);
116
+        int expected = 3;
117
+        int actual = map1.getSize();
118
+
119
+        Assert.assertEquals(expected, actual);
120
+    }
121
+
122
+    @Test
123
+    public void testRemoveByKey() {
124
+        MyMap<Integer, String> map1 = new MyMap<>();
125
+        map1.put(numb1, str1);
126
+        map1.removeByKey(numb1);
127
+
128
+        Assert.assertNull(map1.get(numb1));
129
+
130
+    }
131
+
81 132
 }
82 133