瀏覽代碼

added MyMap class

thulasi 6 年之前
父節點
當前提交
e06910a259
共有 5 個文件被更改,包括 341 次插入177 次删除
  1. 173
    177
      .idea/workspace.xml
  2. 8
    0
      src/main/java/MyArrayList.java
  3. 74
    0
      src/main/java/MyMap.java
  4. 10
    0
      src/main/java/MySet.java
  5. 76
    0
      src/test/java/MyMapTest.java

+ 173
- 177
.idea/workspace.xml 查看文件

@@ -2,6 +2,10 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="6a8e162c-afd9-4415-8c4f-40bb1a6f9e53" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/src/main/java/MyMap.java" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/src/test/java/MyMapTest.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
5 9
       <change beforePath="$PROJECT_DIR$/src/main/java/MySet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
6 10
     </list>
7 11
     <ignored path="$PROJECT_DIR$/target/" />
@@ -11,105 +15,119 @@
11 15
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12 16
     <option name="LAST_RESOLUTION" value="IGNORE" />
13 17
   </component>
18
+  <component name="DatabaseView">
19
+    <option name="SHOW_INTERMEDIATE" value="true" />
20
+    <option name="GROUP_DATA_SOURCES" value="true" />
21
+    <option name="GROUP_SCHEMA" value="true" />
22
+    <option name="GROUP_CONTENTS" value="false" />
23
+    <option name="SORT_POSITIONED" value="false" />
24
+    <option name="SHOW_EMPTY_GROUPS" value="false" />
25
+    <option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
26
+    <option name="HIDDEN_KINDS">
27
+      <set />
28
+    </option>
29
+    <expand />
30
+    <select />
31
+  </component>
14 32
   <component name="FUSProjectUsageTrigger">
15 33
     <session id="-321049765">
16 34
       <usages-collector id="statistics.lifecycle.project">
17 35
         <counts>
36
+          <entry key="project.closed" value="1" />
18 37
           <entry key="project.open.time.2" value="1" />
19
-          <entry key="project.opened" value="1" />
38
+          <entry key="project.open.time.5" value="1" />
39
+          <entry key="project.opened" value="2" />
20 40
         </counts>
21 41
       </usages-collector>
22 42
       <usages-collector id="statistics.file.extensions.open">
23 43
         <counts>
24 44
           <entry key="class" value="12" />
25
-          <entry key="java" value="5" />
45
+          <entry key="java" value="8" />
26 46
         </counts>
27 47
       </usages-collector>
28 48
       <usages-collector id="statistics.file.types.open">
29 49
         <counts>
30 50
           <entry key="CLASS" value="12" />
31
-          <entry key="JAVA" value="5" />
51
+          <entry key="JAVA" value="8" />
32 52
         </counts>
33 53
       </usages-collector>
34 54
       <usages-collector id="statistics.file.extensions.edit">
35 55
         <counts>
36
-          <entry key="java" value="2687" />
56
+          <entry key="java" value="4294" />
37 57
         </counts>
38 58
       </usages-collector>
39 59
       <usages-collector id="statistics.file.types.edit">
40 60
         <counts>
41
-          <entry key="JAVA" value="2687" />
61
+          <entry key="JAVA" value="4294" />
42 62
         </counts>
43 63
       </usages-collector>
44 64
     </session>
45 65
   </component>
46 66
   <component name="FileEditorManager">
47
-    <leaf>
67
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
48 68
       <file pinned="false" current-in-tab="false">
49 69
         <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
50 70
           <provider selected="true" editor-type-id="text-editor">
51
-            <state relative-caret-position="276">
52
-              <caret line="34" column="25" lean-forward="true" selection-start-line="34" selection-start-column="25" selection-end-line="34" selection-end-column="25" />
71
+            <state relative-caret-position="142">
72
+              <caret line="110" column="27" selection-start-line="110" selection-start-column="27" selection-end-line="110" selection-end-column="27" />
53 73
               <folding>
54 74
                 <element signature="imports" expanded="true" />
55 75
                 <element signature="e#205#206#0" expanded="true" />
56 76
                 <element signature="e#249#250#0" expanded="true" />
57 77
                 <element signature="e#285#286#0" expanded="true" />
58 78
                 <element signature="e#332#333#0" expanded="true" />
59
-                <element signature="e#1757#1758#0" expanded="true" />
60
-                <element signature="e#1796#1797#0" expanded="true" />
61
-                <element signature="e#2158#2159#0" expanded="true" />
62
-                <element signature="e#2195#2196#0" expanded="true" />
63 79
               </folding>
64 80
             </state>
65 81
           </provider>
66 82
         </entry>
67 83
       </file>
68 84
       <file pinned="false" current-in-tab="false">
69
-        <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
85
+        <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
70 86
           <provider selected="true" editor-type-id="text-editor">
71
-            <state relative-caret-position="150">
72
-              <caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
87
+            <state relative-caret-position="1020">
88
+              <caret line="68" column="30" lean-forward="true" selection-start-line="68" selection-start-column="30" selection-end-line="68" selection-end-column="30" />
73 89
               <folding>
74
-                <element signature="imports" expanded="true" />
90
+                <element signature="e#219#220#0" expanded="true" />
91
+                <element signature="e#245#246#0" expanded="true" />
92
+                <element signature="e#634#635#0" expanded="true" />
93
+                <element signature="e#655#656#0" expanded="true" />
94
+                <element signature="e#724#725#0" expanded="true" />
95
+                <element signature="e#752#753#0" expanded="true" />
96
+                <element signature="e#1518#1519#0" expanded="true" />
75 97
               </folding>
76 98
             </state>
77 99
           </provider>
78 100
         </entry>
79 101
       </file>
80
-      <file pinned="false" current-in-tab="false">
81
-        <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
102
+      <file pinned="false" current-in-tab="true">
103
+        <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
82 104
           <provider selected="true" editor-type-id="text-editor">
83
-            <state relative-caret-position="123">
84
-              <caret line="76" selection-start-line="76" selection-end-line="76" />
105
+            <state relative-caret-position="232">
106
+              <caret line="84" column="63" selection-start-line="84" selection-start-column="63" selection-end-line="84" selection-end-column="63" />
85 107
               <folding>
86
-                <element signature="e#131#132#0" expanded="true" />
87
-                <element signature="e#175#176#0" expanded="true" />
88
-                <element signature="e#211#212#0" expanded="true" />
89
-                <element signature="e#258#259#0" expanded="true" />
90
-                <element signature="e#1625#1626#0" expanded="true" />
91
-                <element signature="e#1718#1719#0" expanded="true" />
92
-                <element signature="e#2123#2124#0" expanded="true" />
93
-                <element signature="e#2161#2162#0" expanded="true" />
108
+                <element signature="imports" expanded="true" />
94 109
               </folding>
95 110
             </state>
96 111
           </provider>
97 112
         </entry>
98 113
       </file>
99
-      <file pinned="false" current-in-tab="true">
100
-        <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
114
+      <file pinned="false" current-in-tab="false">
115
+        <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
101 116
           <provider selected="true" editor-type-id="text-editor">
102
-            <state relative-caret-position="210">
103
-              <caret line="17" selection-start-line="17" selection-end-line="17" />
117
+            <state relative-caret-position="150">
118
+              <caret line="10" selection-start-line="10" selection-end-line="10" />
119
+              <folding>
120
+                <element signature="imports" expanded="true" />
121
+              </folding>
104 122
             </state>
105 123
           </provider>
106 124
         </entry>
107 125
       </file>
108 126
       <file pinned="false" current-in-tab="false">
109
-        <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
127
+        <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
110 128
           <provider selected="true" editor-type-id="text-editor">
111
-            <state relative-caret-position="99">
112
-              <caret line="202" selection-start-line="202" selection-end-line="202" />
129
+            <state relative-caret-position="167">
130
+              <caret line="96" column="41" lean-forward="true" selection-start-line="96" selection-start-column="41" selection-end-line="96" selection-end-column="41" />
113 131
             </state>
114 132
           </provider>
115 133
         </entry>
@@ -136,9 +154,11 @@
136 154
       <list>
137 155
         <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
138 156
         <option value="$PROJECT_DIR$/src/main/java/mySet.java" />
139
-        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
140 157
         <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
158
+        <option value="$PROJECT_DIR$/src/main/java/MyMap.java" />
141 159
         <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
160
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
161
+        <option value="$PROJECT_DIR$/src/test/java/MyMapTest.java" />
142 162
       </list>
143 163
     </option>
144 164
   </component>
@@ -159,6 +179,17 @@
159 179
       <foldersAlwaysOnTop value="true" />
160 180
     </navigator>
161 181
     <panes>
182
+      <pane id="PackagesPane">
183
+        <subPane>
184
+          <expand>
185
+            <path>
186
+              <item name="generics" type="58d84e3e:PackageViewProjectNode" />
187
+              <item name="generics" type="616d4139:PackageViewModuleNode" />
188
+            </path>
189
+          </expand>
190
+          <select />
191
+        </subPane>
192
+      </pane>
162 193
       <pane id="Scope">
163 194
         <subPane subId="Scope 'Tests'; set:Tests; class com.intellij.psi.search.scope.TestsScope">
164 195
           <expand>
@@ -228,25 +259,14 @@
228 259
           <select />
229 260
         </subPane>
230 261
       </pane>
231
-      <pane id="PackagesPane">
232
-        <subPane>
233
-          <expand>
234
-            <path>
235
-              <item name="generics" type="58d84e3e:PackageViewProjectNode" />
236
-              <item name="generics" type="616d4139:PackageViewModuleNode" />
237
-            </path>
238
-          </expand>
239
-          <select />
240
-        </subPane>
241
-      </pane>
242 262
       <pane id="ProjectPane" />
243 263
     </panes>
244 264
   </component>
245 265
   <component name="PropertiesComponent">
246 266
     <property name="WebServerToolWindowFactoryState" value="false" />
247 267
     <property name="aspect.path.notification.shown" value="true" />
248
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542227780702" />
249
-    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
268
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542545579262" />
269
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
250 270
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
251 271
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
252 272
   </component>
@@ -262,7 +282,7 @@
262 282
       </list>
263 283
     </option>
264 284
   </component>
265
-  <component name="RunManager" selected="JUnit.MySetTest">
285
+  <component name="RunManager" selected="JUnit.MyArrayListTest">
266 286
     <configuration name="MyArrayListTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
267 287
       <module name="generics" />
268 288
       <option name="PACKAGE_NAME" value="" />
@@ -281,12 +301,10 @@
281 301
         <option name="Make" enabled="true" />
282 302
       </method>
283 303
     </configuration>
284
-    <configuration name="MyArrayListTest.testSet" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
304
+    <configuration name="MyMapTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
285 305
       <module name="generics" />
286 306
       <option name="PACKAGE_NAME" value="" />
287
-      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
288
-      <option name="METHOD_NAME" value="testSet" />
289
-      <option name="TEST_OBJECT" value="method" />
307
+      <option name="MAIN_CLASS_NAME" value="MyMapTest" />
290 308
       <method v="2">
291 309
         <option name="Make" enabled="true" />
292 310
       </method>
@@ -311,18 +329,18 @@
311 329
     </configuration>
312 330
     <list>
313 331
       <item itemvalue="JUnit.MyArrayListTest" />
314
-      <item itemvalue="JUnit.MyArrayListTest.testSet" />
315 332
       <item itemvalue="JUnit.MyArrayListTest.testAddAtIndex" />
316 333
       <item itemvalue="JUnit.MySetTest" />
317 334
       <item itemvalue="JUnit.MySetTest.testAddAtIndex" />
335
+      <item itemvalue="JUnit.MyMapTest" />
318 336
     </list>
319 337
     <recent_temporary>
320 338
       <list>
339
+        <item itemvalue="JUnit.MyArrayListTest" />
321 340
         <item itemvalue="JUnit.MySetTest" />
341
+        <item itemvalue="JUnit.MyMapTest" />
322 342
         <item itemvalue="JUnit.MySetTest.testAddAtIndex" />
323 343
         <item itemvalue="JUnit.MyArrayListTest.testAddAtIndex" />
324
-        <item itemvalue="JUnit.MyArrayListTest" />
325
-        <item itemvalue="JUnit.MyArrayListTest.testSet" />
326 344
       </list>
327 345
     </recent_temporary>
328 346
   </component>
@@ -336,76 +354,78 @@
336 354
       <option name="number" value="Default" />
337 355
       <option name="presentableId" value="Default" />
338 356
       <updated>1542144297867</updated>
339
-      <workItem from="1542144301266" duration="23107000" />
357
+      <workItem from="1542144301266" duration="24225000" />
358
+      <workItem from="1542463630943" duration="6336000" />
340 359
     </task>
341 360
     <servers />
342 361
   </component>
343 362
   <component name="TestHistory">
344
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 09h 05m 29s.xml">
363
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 37s.xml">
345 364
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
346 365
     </history-entry>
347
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 49m 10s.xml">
366
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 47s.xml">
348 367
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
349 368
     </history-entry>
350
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 49m 56s.xml">
369
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 35m 23s.xml">
351 370
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
352 371
     </history-entry>
353
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 51m 01s.xml">
372
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 35m 36s.xml">
354 373
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
355 374
     </history-entry>
356
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 52m 14s.xml">
375
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 35m 49s.xml">
357 376
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
358 377
     </history-entry>
359
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 54m 05s.xml">
378
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 36m 22s.xml">
360 379
       <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
361 380
     </history-entry>
362
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 26m 58s.xml">
363
-      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
381
+    <history-entry file="MySetTest - 2018.11.14 at 15h 37m 37s.xml">
382
+      <configuration name="MySetTest" configurationId="JUnit" />
364 383
     </history-entry>
365
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 37s.xml">
366
-      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
384
+    <history-entry file="MyMapTest - 2018.11.18 at 07h 44m 20s.xml">
385
+      <configuration name="MyMapTest" configurationId="JUnit" />
367 386
     </history-entry>
368
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 47s.xml">
369
-      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
387
+    <history-entry file="MyMapTest - 2018.11.18 at 07h 44m 43s.xml">
388
+      <configuration name="MyMapTest" configurationId="JUnit" />
370 389
     </history-entry>
371
-    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 35m 23s.xml">
372
-      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
390
+    <history-entry file="MyMapTest - 2018.11.18 at 07h 45m 05s.xml">
391
+      <configuration name="MyMapTest" configurationId="JUnit" />
373 392
     </history-entry>
374 393
   </component>
375 394
   <component name="TimeTrackingManager">
376
-    <option name="totallyTimeSpent" value="23107000" />
395
+    <option name="totallyTimeSpent" value="30561000" />
377 396
   </component>
378 397
   <component name="ToolWindowManager">
379 398
     <frame x="0" y="23" width="1280" height="709" extended-state="0" />
399
+    <editor active="true" />
380 400
     <layout>
381
-      <window_info id="Image Layers" />
382
-      <window_info id="Designer" />
383
-      <window_info id="UI Designer" />
384
-      <window_info id="Capture Tool" />
385
-      <window_info id="Favorites" side_tool="true" />
386
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16235864" />
401
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16478191" />
387 402
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
388
-      <window_info anchor="bottom" id="Messages" weight="0.32901135" />
389
-      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
390
-      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
391
-      <window_info anchor="bottom" id="Terminal" weight="0.32901135" />
392
-      <window_info anchor="bottom" id="Event Log" side_tool="true" />
403
+      <window_info id="Image Layers" order="2" />
404
+      <window_info id="Designer" order="3" />
405
+      <window_info id="UI Designer" order="4" />
406
+      <window_info id="Capture Tool" order="5" />
407
+      <window_info id="Favorites" order="6" side_tool="true" />
393 408
       <window_info anchor="bottom" id="Message" order="0" />
394 409
       <window_info anchor="bottom" id="Find" order="1" weight="0.32901135" />
395
-      <window_info anchor="bottom" id="Run" order="2" weight="0.32901135" />
396
-      <window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.3987034" />
410
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32901135" />
411
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.3987034" />
397 412
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
398 413
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
399 414
       <window_info anchor="bottom" id="TODO" order="6" />
400
-      <window_info anchor="right" id="Palette" />
401
-      <window_info anchor="right" id="Theme Preview" />
402
-      <window_info anchor="right" id="Capture Analysis" />
403
-      <window_info anchor="right" id="Palette&#9;" />
404
-      <window_info anchor="right" id="Database" />
405
-      <window_info anchor="right" id="Maven Projects" />
415
+      <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
416
+      <window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
417
+      <window_info anchor="bottom" id="Terminal" order="9" weight="0.32901135" />
418
+      <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
419
+      <window_info anchor="bottom" id="Messages" order="11" weight="0.32901135" />
406 420
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
407 421
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
408 422
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
423
+      <window_info anchor="right" id="Palette" order="3" />
424
+      <window_info anchor="right" id="Capture Analysis" order="4" />
425
+      <window_info anchor="right" id="Database" order="5" weight="0.32956383" />
426
+      <window_info anchor="right" id="Theme Preview" order="6" />
427
+      <window_info anchor="right" id="Palette&#9;" order="7" />
428
+      <window_info anchor="right" id="Maven Projects" order="8" />
409 429
     </layout>
410 430
     <layout-to-restore>
411 431
       <window_info id="Image Layers" order="0" />
@@ -444,130 +464,106 @@
444 464
   <component name="VcsContentAnnotationSettings">
445 465
     <option name="myLimit" value="2678400000" />
446 466
   </component>
447
-  <component name="XDebuggerManager">
448
-    <breakpoint-manager>
449
-      <breakpoints>
450
-        <line-breakpoint enabled="true" type="java-line">
451
-          <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
452
-          <line>22</line>
453
-          <properties />
454
-          <option name="timeStamp" value="4" />
455
-        </line-breakpoint>
456
-        <line-breakpoint enabled="true" type="java-line">
457
-          <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
458
-          <line>24</line>
459
-          <properties />
460
-          <option name="timeStamp" value="5" />
461
-        </line-breakpoint>
462
-        <line-breakpoint enabled="true" type="java-line">
463
-          <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
464
-          <line>26</line>
465
-          <properties />
466
-          <option name="timeStamp" value="7" />
467
-        </line-breakpoint>
468
-        <line-breakpoint enabled="true" type="java-line">
469
-          <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
470
-          <line>29</line>
471
-          <properties />
472
-          <option name="timeStamp" value="8" />
473
-        </line-breakpoint>
474
-        <line-breakpoint enabled="true" type="java-line">
475
-          <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
476
-          <line>77</line>
477
-          <properties />
478
-          <option name="timeStamp" value="10" />
479
-        </line-breakpoint>
480
-      </breakpoints>
481
-    </breakpoint-manager>
482
-  </component>
483 467
   <component name="editorHistoryManager">
484
-    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
468
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/model/FrameworkMethod.class">
485 469
       <provider selected="true" editor-type-id="text-editor">
486
-        <state relative-caret-position="276">
487
-          <caret line="34" column="25" lean-forward="true" selection-start-line="34" selection-start-column="25" selection-end-line="34" selection-end-column="25" />
488
-          <folding>
489
-            <element signature="imports" expanded="true" />
490
-            <element signature="e#205#206#0" expanded="true" />
491
-            <element signature="e#249#250#0" expanded="true" />
492
-            <element signature="e#285#286#0" expanded="true" />
493
-            <element signature="e#332#333#0" expanded="true" />
494
-            <element signature="e#1757#1758#0" expanded="true" />
495
-            <element signature="e#1796#1797#0" expanded="true" />
496
-            <element signature="e#2158#2159#0" expanded="true" />
497
-            <element signature="e#2195#2196#0" expanded="true" />
498
-          </folding>
470
+        <state relative-caret-position="220">
471
+          <caret line="56" column="9" lean-forward="true" selection-start-line="56" selection-start-column="9" selection-end-line="56" selection-end-column="9" />
499 472
         </state>
500 473
       </provider>
501 474
     </entry>
502
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/model/FrameworkMethod.class">
475
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/JUnitCore.class">
503 476
       <provider selected="true" editor-type-id="text-editor">
504
-        <state relative-caret-position="220">
505
-          <caret line="56" column="9" lean-forward="true" selection-start-line="56" selection-start-column="9" selection-end-line="56" selection-end-column="9" />
477
+        <state relative-caret-position="99">
478
+          <caret line="76" selection-start-line="76" selection-end-line="76" />
506 479
         </state>
507 480
       </provider>
508 481
     </entry>
509
-    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
482
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/BlockJUnit4ClassRunner.class">
510 483
       <provider selected="true" editor-type-id="text-editor">
511
-        <state relative-caret-position="150">
512
-          <caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
513
-          <folding>
514
-            <element signature="imports" expanded="true" />
515
-          </folding>
484
+        <state relative-caret-position="99">
485
+          <caret line="49" selection-start-line="49" selection-end-line="49" />
486
+        </state>
487
+      </provider>
488
+    </entry>
489
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
490
+      <provider selected="true" editor-type-id="text-editor">
491
+        <state relative-caret-position="99">
492
+          <caret line="202" selection-start-line="202" selection-end-line="202" />
493
+        </state>
494
+      </provider>
495
+    </entry>
496
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
497
+      <provider selected="true" editor-type-id="text-editor">
498
+        <state relative-caret-position="195">
499
+          <caret line="16" selection-start-line="16" selection-end-line="16" />
516 500
         </state>
517 501
       </provider>
518 502
     </entry>
519 503
     <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
520 504
       <provider selected="true" editor-type-id="text-editor">
521
-        <state relative-caret-position="329">
522
-          <caret line="30" column="37" lean-forward="true" selection-start-line="30" selection-start-column="37" selection-end-line="30" selection-end-column="37" />
505
+        <state relative-caret-position="105">
506
+          <caret line="7" column="13" lean-forward="true" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
523 507
           <folding>
524 508
             <element signature="imports" expanded="true" />
525 509
           </folding>
526 510
         </state>
527 511
       </provider>
528 512
     </entry>
529
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/JUnitCore.class">
513
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
530 514
       <provider selected="true" editor-type-id="text-editor">
531
-        <state relative-caret-position="99">
532
-          <caret line="76" selection-start-line="76" selection-end-line="76" />
515
+        <state relative-caret-position="150">
516
+          <caret line="10" selection-start-line="10" selection-end-line="10" />
517
+          <folding>
518
+            <element signature="imports" expanded="true" />
519
+          </folding>
533 520
         </state>
534 521
       </provider>
535 522
     </entry>
536
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/BlockJUnit4ClassRunner.class">
523
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyMap.java">
537 524
       <provider selected="true" editor-type-id="text-editor">
538
-        <state relative-caret-position="99">
539
-          <caret line="49" selection-start-line="49" selection-end-line="49" />
525
+        <state relative-caret-position="1020">
526
+          <caret line="68" column="30" lean-forward="true" selection-start-line="68" selection-start-column="30" selection-end-line="68" selection-end-column="30" />
527
+          <folding>
528
+            <element signature="e#219#220#0" expanded="true" />
529
+            <element signature="e#245#246#0" expanded="true" />
530
+            <element signature="e#634#635#0" expanded="true" />
531
+            <element signature="e#655#656#0" expanded="true" />
532
+            <element signature="e#724#725#0" expanded="true" />
533
+            <element signature="e#752#753#0" expanded="true" />
534
+            <element signature="e#1518#1519#0" expanded="true" />
535
+          </folding>
540 536
         </state>
541 537
       </provider>
542 538
     </entry>
543
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
539
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
544 540
       <provider selected="true" editor-type-id="text-editor">
545
-        <state relative-caret-position="99">
546
-          <caret line="202" selection-start-line="202" selection-end-line="202" />
541
+        <state relative-caret-position="142">
542
+          <caret line="110" column="27" selection-start-line="110" selection-start-column="27" selection-end-line="110" selection-end-column="27" />
543
+          <folding>
544
+            <element signature="imports" expanded="true" />
545
+            <element signature="e#205#206#0" expanded="true" />
546
+            <element signature="e#249#250#0" expanded="true" />
547
+            <element signature="e#285#286#0" expanded="true" />
548
+            <element signature="e#332#333#0" expanded="true" />
549
+          </folding>
547 550
         </state>
548 551
       </provider>
549 552
     </entry>
550 553
     <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
551 554
       <provider selected="true" editor-type-id="text-editor">
552
-        <state relative-caret-position="123">
553
-          <caret line="76" selection-start-line="76" selection-end-line="76" />
554
-          <folding>
555
-            <element signature="e#131#132#0" expanded="true" />
556
-            <element signature="e#175#176#0" expanded="true" />
557
-            <element signature="e#211#212#0" expanded="true" />
558
-            <element signature="e#258#259#0" expanded="true" />
559
-            <element signature="e#1625#1626#0" expanded="true" />
560
-            <element signature="e#1718#1719#0" expanded="true" />
561
-            <element signature="e#2123#2124#0" expanded="true" />
562
-            <element signature="e#2161#2162#0" expanded="true" />
563
-          </folding>
555
+        <state relative-caret-position="167">
556
+          <caret line="96" column="41" lean-forward="true" selection-start-line="96" selection-start-column="41" selection-end-line="96" selection-end-column="41" />
564 557
         </state>
565 558
       </provider>
566 559
     </entry>
567
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
560
+    <entry file="file://$PROJECT_DIR$/src/test/java/MyMapTest.java">
568 561
       <provider selected="true" editor-type-id="text-editor">
569
-        <state relative-caret-position="210">
570
-          <caret line="17" selection-start-line="17" selection-end-line="17" />
562
+        <state relative-caret-position="232">
563
+          <caret line="84" column="63" selection-start-line="84" selection-start-column="63" selection-end-line="84" selection-end-column="63" />
564
+          <folding>
565
+            <element signature="imports" expanded="true" />
566
+          </folding>
571 567
         </state>
572 568
       </provider>
573 569
     </entry>

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

@@ -94,6 +94,14 @@ public class MyArrayList<E> {
94 94
         return false;
95 95
     }
96 96
 
97
+    public int getIndex(Object o){
98
+        for(int i=0; i<this.size();i++){
99
+            if(myArray[i].equals(o))
100
+                return i;
101
+        }
102
+        return -1;
103
+    }
104
+
97 105
     public int size(){
98 106
         return myArray.length;
99 107
     }

+ 74
- 0
src/main/java/MyMap.java 查看文件

@@ -0,0 +1,74 @@
1
+import java.util.Set;
2
+
3
+public class MyMap<K,V> {
4
+    MyArrayList<V> values;
5
+    MySet<K> keySet;
6
+    int size;
7
+
8
+    public MyMap() {
9
+        this.values = new MyArrayList<>();
10
+        this.keySet = new MySet<>();
11
+        this.size = 0;
12
+    }
13
+
14
+    public int getSize(){
15
+        return this.size;
16
+    }
17
+
18
+    public void put(Object i, Object x) {
19
+        int index = 0;
20
+        if(keySet.contains(i)){
21
+            index = keySet.getIndex(i);
22
+            values.add(index,x);
23
+        }
24
+        else {
25
+            keySet.add(i);
26
+            values.add(x);
27
+            this.size += 1;
28
+        }
29
+    }
30
+
31
+    public boolean containsKey(Object i) {
32
+        return keySet.contains(i);
33
+    }
34
+
35
+    public boolean containsValue(Object y) {
36
+        return values.contains(y);
37
+    }
38
+
39
+    public Object get(Object i) {
40
+        int index = keySet.getIndex(i);
41
+        Object value =values.get(index);
42
+        return value;
43
+    }
44
+
45
+    public void clear() {
46
+        keySet.clear();
47
+        values.clear();
48
+    }
49
+
50
+    public boolean isEmpty() {
51
+        if(keySet.isEmpty() && values.isEmpty())
52
+            return true;
53
+        else
54
+            return false;
55
+    }
56
+
57
+    public Object remove(Object key) {
58
+        if(keySet.contains(key)){
59
+            int index = keySet.getIndex(key);
60
+            keySet.remove(key);
61
+            Object value = values.get(index);
62
+            values.remove(value);
63
+            return value;
64
+        }
65
+        else
66
+            return null;
67
+    }
68
+
69
+    public MySet<K> keyset() {
70
+        return keySet;
71
+    }
72
+
73
+
74
+}

+ 10
- 0
src/main/java/MySet.java 查看文件

@@ -19,6 +19,14 @@ public class MySet<E> {
19 19
         }
20 20
     }
21 21
 
22
+    public int getIndex(Object o){
23
+        for(int i=0; i<this.size();i++){
24
+            if(set[i].equals(o))
25
+                return i;
26
+        }
27
+        return -1;
28
+    }
29
+
22 30
     public void add(int index, Object d) {
23 31
         if(!this.contains(d)) {
24 32
             Object[] newArr = new Object[set.length + 1];
@@ -84,4 +92,6 @@ public class MySet<E> {
84 92
     public int size(){
85 93
         return this.set.length;
86 94
     }
95
+
96
+
87 97
 }

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

@@ -0,0 +1,76 @@
1
+import org.junit.Assert;
2
+import org.junit.Before;
3
+import org.junit.Test;
4
+
5
+import java.util.HashSet;
6
+import java.util.Set;
7
+
8
+public class MyMapTest<K,V> {
9
+    /*MyArrayList<K> list;
10
+    MySet<V> set;*/
11
+    MyMap<K,V> map;
12
+
13
+    @Before
14
+    public void setup(){
15
+        /*list = new MyArrayList<>();
16
+        set = new MySet<>();*/
17
+        map = new MyMap<>();
18
+    }
19
+
20
+    @Test
21
+    public void testContainsKey(){
22
+        map.put(1, "x");
23
+        boolean expected = true;
24
+        boolean actual = map.containsKey(1);
25
+        Assert.assertEquals(expected, actual);
26
+    }
27
+
28
+    @Test
29
+    public void testContainsValue(){
30
+        map.put(1, "y");
31
+        boolean expected = true;
32
+        boolean actual = map.containsValue("y");
33
+        Assert.assertEquals(expected, actual);
34
+    }
35
+
36
+    @Test
37
+    public void testPut(){
38
+        map.put(2,"e");
39
+        int expected = 1;
40
+        int actual = map.getSize();
41
+        Assert.assertEquals(expected, actual);
42
+    }
43
+
44
+    @Test
45
+    public void testGet(){
46
+        map.put(2,"d");
47
+        String expected = "d";
48
+        String actual = (String) map.get(2);
49
+        Assert.assertEquals(expected, actual);
50
+    }
51
+
52
+    @Test
53
+    public void testClearAndIsEmpty(){
54
+        map.clear();
55
+        boolean expected = true;
56
+        boolean actual = map.isEmpty();
57
+        Assert.assertEquals(expected, actual);
58
+    }
59
+
60
+    @Test
61
+    public void testRemove(){
62
+        map.put(1,"x");
63
+        String expected = "x";
64
+        String actual = (String) map.remove(1);
65
+        Assert.assertEquals(expected, actual);
66
+    }
67
+
68
+    @Test
69
+    public void testSize(){
70
+        map.put(2,"y");
71
+        int expected = 1;
72
+        int actual = map.getSize();
73
+        Assert.assertEquals(expected, actual);
74
+    }
75
+
76
+}