Pārlūkot izejas kodu

MyArrayList - Complete

MySet - Working
add, get, contains, remove, addAll
Nick Satinover 6 gadus atpakaļ
vecāks
revīzija
a8980642d5
3 mainītis faili ar 103 papildinājumiem un 122 dzēšanām
  1. 94
    98
      .idea/workspace.xml
  2. 7
    20
      src/main/java/MySet.java
  3. 2
    4
      src/test/java/MySetTest.java

+ 94
- 98
.idea/workspace.xml Parādīt failu

@@ -2,6 +2,7 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="6eefb94a-8003-4639-a54f-0d11804b5db5" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
5 6
       <change beforePath="$PROJECT_DIR$/src/main/java/MySet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
6 7
       <change beforePath="$PROJECT_DIR$/src/test/java/MySetTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
7 8
     </list>
@@ -32,7 +33,7 @@
32 33
       </usages-collector>
33 34
       <usages-collector id="statistics.file.extensions.open">
34 35
         <counts>
35
-          <entry key="class" value="14" />
36
+          <entry key="class" value="17" />
36 37
           <entry key="iml" value="2" />
37 38
           <entry key="java" value="21" />
38 39
           <entry key="xml" value="1" />
@@ -40,7 +41,7 @@
40 41
       </usages-collector>
41 42
       <usages-collector id="statistics.file.types.open">
42 43
         <counts>
43
-          <entry key="CLASS" value="14" />
44
+          <entry key="CLASS" value="17" />
44 45
           <entry key="IDEA_MODULE" value="2" />
45 46
           <entry key="JAVA" value="21" />
46 47
           <entry key="XML" value="1" />
@@ -48,14 +49,14 @@
48 49
       </usages-collector>
49 50
       <usages-collector id="statistics.file.extensions.edit">
50 51
         <counts>
51
-          <entry key="java" value="2070" />
52
+          <entry key="java" value="2377" />
52 53
           <entry key="txt" value="94" />
53 54
           <entry key="xml" value="2" />
54 55
         </counts>
55 56
       </usages-collector>
56 57
       <usages-collector id="statistics.file.types.edit">
57 58
         <counts>
58
-          <entry key="JAVA" value="2070" />
59
+          <entry key="JAVA" value="2377" />
59 60
           <entry key="PLAIN_TEXT" value="94" />
60 61
           <entry key="XML" value="2" />
61 62
         </counts>
@@ -69,26 +70,27 @@
69 70
           <file pinned="false" current-in-tab="true">
70 71
             <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
71 72
               <provider selected="true" editor-type-id="text-editor">
72
-                <state relative-caret-position="155">
73
-                  <caret line="113" column="86" lean-forward="true" selection-start-line="113" selection-start-column="86" selection-end-line="113" selection-end-column="86" />
73
+                <state relative-caret-position="347">
74
+                  <caret line="116" column="81" selection-start-line="116" selection-start-column="81" selection-end-line="116" selection-end-column="81" />
74 75
                   <folding>
75 76
                     <element signature="imports" expanded="true" />
76 77
                     <element signature="e#244#245#0" expanded="true" />
77 78
                     <element signature="e#286#287#0" expanded="true" />
78 79
                     <element signature="e#310#311#0" expanded="true" />
79 80
                     <element signature="e#348#349#0" expanded="true" />
80
-                    <element signature="e#457#458#0" expanded="true" />
81
-                    <element signature="e#485#486#0" expanded="true" />
82 81
                     <element signature="e#817#818#0" expanded="true" />
83 82
                     <element signature="e#844#845#0" expanded="true" />
84
-                    <element signature="e#1819#1820#0" expanded="true" />
85
-                    <element signature="e#1847#1848#0" expanded="true" />
86
-                    <element signature="e#1907#1908#0" expanded="true" />
87
-                    <element signature="e#1935#1936#0" expanded="true" />
88
-                    <element signature="e#1997#1998#0" expanded="true" />
89
-                    <element signature="e#2025#2026#0" expanded="true" />
90
-                    <element signature="e#2082#2083#0" expanded="true" />
91
-                    <element signature="e#2118#2119#0" expanded="true" />
83
+                    <element signature="method#toArray#0;class#MySet#0" />
84
+                    <element signature="method#add#0;class#MySet#0" />
85
+                    <element signature="method#remove#0;class#MySet#0" />
86
+                    <element signature="e#2975#2976#0" expanded="true" />
87
+                    <element signature="e#3003#3004#0" expanded="true" />
88
+                    <element signature="e#3063#3064#0" expanded="true" />
89
+                    <element signature="e#3091#3092#0" expanded="true" />
90
+                    <element signature="e#3153#3154#0" expanded="true" />
91
+                    <element signature="e#3181#3182#0" expanded="true" />
92
+                    <element signature="e#3238#3239#0" expanded="true" />
93
+                    <element signature="e#3274#3275#0" expanded="true" />
92 94
                   </folding>
93 95
                 </state>
94 96
               </provider>
@@ -97,8 +99,8 @@
97 99
           <file pinned="false" current-in-tab="false">
98 100
             <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/Set.java">
99 101
               <provider selected="true" editor-type-id="text-editor">
100
-                <state relative-caret-position="299">
101
-                  <caret line="301" column="70" lean-forward="true" selection-start-line="277" selection-start-column="41" selection-end-line="277" selection-end-column="45" />
102
+                <state relative-caret-position="-3798">
103
+                  <caret line="84" column="35" lean-forward="true" selection-start-line="84" selection-start-column="35" selection-end-line="84" selection-end-column="35" />
102 104
                 </state>
103 105
               </provider>
104 106
             </entry>
@@ -110,8 +112,8 @@
110 112
           <file pinned="false" current-in-tab="true">
111 113
             <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
112 114
               <provider selected="true" editor-type-id="text-editor">
113
-                <state relative-caret-position="336">
114
-                  <caret line="140" column="10" selection-start-line="140" selection-start-column="10" selection-end-line="140" selection-end-column="10" />
115
+                <state relative-caret-position="410">
116
+                  <caret line="142" selection-start-line="142" selection-end-line="142" />
115 117
                   <folding>
116 118
                     <element signature="imports" expanded="true" />
117 119
                     <element signature="e#1474#1480#0" expanded="true" />
@@ -140,12 +142,11 @@
140 142
           <file pinned="false" current-in-tab="false">
141 143
             <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
142 144
               <provider selected="true" editor-type-id="text-editor">
143
-                <state relative-caret-position="360">
144
-                  <caret line="81" selection-start-line="81" selection-end-line="81" />
145
+                <state relative-caret-position="270">
146
+                  <caret line="22" column="41" lean-forward="true" selection-start-line="22" selection-start-column="41" selection-end-line="22" selection-end-column="41" />
145 147
                   <folding>
146 148
                     <element signature="e#151#152#0" expanded="true" />
147 149
                     <element signature="e#197#198#0" expanded="true" />
148
-                    <element signature="method#add#0;class#MyArrayList#0" />
149 150
                     <element signature="method#add#1;class#MyArrayList#0" />
150 151
                     <element signature="method#isEmpty#0;class#MyArrayList#0" />
151 152
                     <element signature="method#contains#0;class#MyArrayList#0" />
@@ -167,8 +168,8 @@
167 168
   </component>
168 169
   <component name="FindInProjectRecents">
169 170
     <findStrings>
170
-      <find>contains</find>
171 171
       <find>addA</find>
172
+      <find>contains</find>
172 173
     </findStrings>
173 174
   </component>
174 175
   <component name="Git.Settings">
@@ -179,10 +180,10 @@
179 180
       <list>
180 181
         <option value="$PROJECT_DIR$/src/main/java/ReadThenDelete.java" />
181 182
         <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
182
-        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
183 183
         <option value="$PROJECT_DIR$/pom.xml" />
184
-        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
184
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
185 185
         <option value="$PROJECT_DIR$/src/test/java/MySetTest.java" />
186
+        <option value="$PROJECT_DIR$/src/main/java/MySet.java" />
186 187
       </list>
187 188
     </option>
188 189
   </component>
@@ -200,9 +201,10 @@
200 201
     </option>
201 202
   </component>
202 203
   <component name="ProjectFrameBounds" extendedState="6">
203
-    <option name="y" value="23" />
204
-    <option name="width" value="1280" />
205
-    <option name="height" value="709" />
204
+    <option name="x" value="-309" />
205
+    <option name="y" value="-1057" />
206
+    <option name="width" value="1920" />
207
+    <option name="height" value="1057" />
206 208
   </component>
207 209
   <component name="ProjectLevelVcsManager" settingsEditedManually="true">
208 210
     <ConfirmationsSetting value="2" id="Add" />
@@ -261,7 +263,7 @@
261 263
   <component name="PropertiesComponent">
262 264
     <property name="WebServerToolWindowFactoryState" value="false" />
263 265
     <property name="aspect.path.notification.shown" value="true" />
264
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542312676654" />
266
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542316330231" />
265 267
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
266 268
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
267 269
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -359,7 +361,7 @@
359 361
       <workItem from="1542145228816" duration="418000" />
360 362
       <workItem from="1542165623771" duration="4833000" />
361 363
       <workItem from="1542225031291" duration="12159000" />
362
-      <workItem from="1542293882069" duration="7429000" />
364
+      <workItem from="1542293882069" duration="10617000" />
363 365
     </task>
364 366
     <task id="LOCAL-00001" summary="MyArrayList&#10;Get, Add">
365 367
       <created>1542167642899</created>
@@ -407,42 +409,42 @@
407 409
     <servers />
408 410
   </component>
409 411
   <component name="TestHistory">
410
-    <history-entry file="MySetTest_removeStringTest - 2018.11.15 at 14h 01m 59s.xml">
411
-      <configuration name="MySetTest.removeStringTest" configurationId="JUnit" />
412
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 40m 07s.xml">
413
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
412 414
     </history-entry>
413
-    <history-entry file="MySetTest_removeStringTest - 2018.11.15 at 14h 03m 39s.xml">
414
-      <configuration name="MySetTest.removeStringTest" configurationId="JUnit" />
415
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 40m 20s.xml">
416
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
415 417
     </history-entry>
416
-    <history-entry file="MySetTest_removeBooleanReturnStringTest - 2018.11.15 at 14h 05m 57s.xml">
417
-      <configuration name="MySetTest.removeBooleanReturnStringTest" configurationId="JUnit" />
418
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 40m 40s.xml">
419
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
418 420
     </history-entry>
419
-    <history-entry file="MySetTest_removeMultipleStringTest - 2018.11.15 at 14h 06m 57s.xml">
420
-      <configuration name="MySetTest.removeMultipleStringTest" configurationId="JUnit" />
421
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 40m 53s.xml">
422
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
421 423
     </history-entry>
422
-    <history-entry file="MySetTest_removeMultipleStringTest - 2018.11.15 at 14h 07m 10s.xml">
423
-      <configuration name="MySetTest.removeMultipleStringTest" configurationId="JUnit" />
424
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 50m 44s.xml">
425
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
424 426
     </history-entry>
425
-    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 14h 39m 38s.xml">
427
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 16h 00m 18s.xml">
426 428
       <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
427 429
     </history-entry>
428
-    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 14h 51m 04s.xml">
430
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 16h 02m 26s.xml">
429 431
       <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
430 432
     </history-entry>
431
-    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 01m 46s.xml">
433
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 16h 03m 34s.xml">
432 434
       <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
433 435
     </history-entry>
434
-    <history-entry file="MySetTest_removeBooleanReturnStringTest - 2018.11.15 at 15h 02m 31s.xml">
435
-      <configuration name="MySetTest.removeBooleanReturnStringTest" configurationId="JUnit" />
436
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 16h 04m 48s.xml">
437
+      <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
436 438
     </history-entry>
437
-    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 15h 09m 59s.xml">
439
+    <history-entry file="MySetTest_addAllLongTest - 2018.11.15 at 16h 06m 45s.xml">
438 440
       <configuration name="MySetTest.addAllLongTest" configurationId="JUnit" />
439 441
     </history-entry>
440 442
   </component>
441 443
   <component name="TimeTrackingManager">
442
-    <option name="totallyTimeSpent" value="24919000" />
444
+    <option name="totallyTimeSpent" value="28107000" />
443 445
   </component>
444 446
   <component name="ToolWindowManager">
445
-    <frame x="0" y="23" width="1280" height="709" extended-state="6" />
447
+    <frame x="-309" y="-1057" width="1920" height="1057" extended-state="6" />
446 448
     <editor active="true" />
447 449
     <layout>
448 450
       <window_info content_ui="combo" id="Project" order="0" weight="0.17285945" />
@@ -454,16 +456,16 @@
454 456
       <window_info id="Favorites" order="6" side_tool="true" />
455 457
       <window_info anchor="bottom" id="Message" order="0" />
456 458
       <window_info anchor="bottom" id="Find" order="1" weight="0.32953367" />
457
-      <window_info anchor="bottom" id="Run" order="2" weight="0.18238342" />
458
-      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
459
+      <window_info anchor="bottom" id="Run" order="2" weight="0.3803109" />
460
+      <window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.32435232" />
459 461
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
460 462
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
461 463
       <window_info anchor="bottom" id="TODO" order="6" />
462 464
       <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
463
-      <window_info anchor="bottom" id="Terminal" order="8" />
465
+      <window_info anchor="bottom" id="Terminal" order="8" weight="0.21036269" />
464 466
       <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
465 467
       <window_info anchor="bottom" id="Version Control" order="10" show_stripe_button="false" />
466
-      <window_info anchor="bottom" id="Messages" order="11" weight="0.32953367" />
468
+      <window_info anchor="bottom" id="Messages" order="11" weight="0.3284974" />
467 469
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
468 470
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
469 471
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -559,21 +561,6 @@
559 561
         </state>
560 562
       </provider>
561 563
     </entry>
562
-    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
563
-      <provider selected="true" editor-type-id="text-editor">
564
-        <state relative-caret-position="360">
565
-          <caret line="81" selection-start-line="81" selection-end-line="81" />
566
-          <folding>
567
-            <element signature="e#151#152#0" expanded="true" />
568
-            <element signature="e#197#198#0" expanded="true" />
569
-            <element signature="method#add#0;class#MyArrayList#0" />
570
-            <element signature="method#add#1;class#MyArrayList#0" />
571
-            <element signature="method#isEmpty#0;class#MyArrayList#0" />
572
-            <element signature="method#contains#0;class#MyArrayList#0" />
573
-          </folding>
574
-        </state>
575
-      </provider>
576
-    </entry>
577 564
     <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/lang/reflect/Array.java">
578 565
       <provider selected="true" editor-type-id="text-editor">
579 566
         <state relative-caret-position="254">
@@ -595,70 +582,79 @@
595 582
         </state>
596 583
       </provider>
597 584
     </entry>
598
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/notification/RunNotifier.class">
585
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/notification/Failure.class">
599 586
       <provider selected="true" editor-type-id="text-editor">
600
-        <state relative-caret-position="163">
601
-          <caret line="77" selection-start-line="77" selection-end-line="77" />
587
+        <state relative-caret-position="210">
588
+          <caret line="20" selection-start-line="20" selection-end-line="20" />
589
+        </state>
590
+      </provider>
591
+    </entry>
592
+    <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
593
+      <provider selected="true" editor-type-id="text-editor">
594
+        <state relative-caret-position="270">
595
+          <caret line="22" column="41" lean-forward="true" selection-start-line="22" selection-start-column="41" selection-end-line="22" selection-end-column="41" />
602 596
           <folding>
603
-            <element signature="e#2379#2380#0" expanded="true" />
604
-            <element signature="e#2456#2457#0" expanded="true" />
605
-            <element signature="e#4424#4425#0" expanded="true" />
606
-            <element signature="e#4488#4489#0" expanded="true" />
597
+            <element signature="e#151#152#0" expanded="true" />
598
+            <element signature="e#197#198#0" expanded="true" />
599
+            <element signature="method#add#1;class#MyArrayList#0" />
600
+            <element signature="method#isEmpty#0;class#MyArrayList#0" />
601
+            <element signature="method#contains#0;class#MyArrayList#0" />
607 602
           </folding>
608 603
         </state>
609 604
       </provider>
610 605
     </entry>
611
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/notification/Failure.class">
606
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/Set.java">
612 607
       <provider selected="true" editor-type-id="text-editor">
613
-        <state relative-caret-position="210">
614
-          <caret line="20" selection-start-line="20" selection-end-line="20" />
608
+        <state relative-caret-position="-3798">
609
+          <caret line="84" column="35" lean-forward="true" selection-start-line="84" selection-start-column="35" selection-end-line="84" selection-end-column="35" />
615 610
         </state>
616 611
       </provider>
617 612
     </entry>
618
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
613
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/notification/RunNotifier.class">
619 614
       <provider selected="true" editor-type-id="text-editor">
620
-        <state relative-caret-position="210">
621
-          <caret line="17" selection-start-line="17" selection-end-line="17" />
615
+        <state relative-caret-position="226">
616
+          <caret line="77" selection-start-line="77" selection-end-line="77" />
622 617
         </state>
623 618
       </provider>
624 619
     </entry>
625
-    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/Set.java">
620
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
626 621
       <provider selected="true" editor-type-id="text-editor">
627
-        <state relative-caret-position="299">
628
-          <caret line="301" column="70" lean-forward="true" selection-start-line="277" selection-start-column="41" selection-end-line="277" selection-end-column="45" />
622
+        <state relative-caret-position="195">
623
+          <caret line="16" selection-start-line="16" selection-end-line="16" />
629 624
         </state>
630 625
       </provider>
631 626
     </entry>
632 627
     <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
633 628
       <provider selected="true" editor-type-id="text-editor">
634
-        <state relative-caret-position="155">
635
-          <caret line="113" column="86" lean-forward="true" selection-start-line="113" selection-start-column="86" selection-end-line="113" selection-end-column="86" />
629
+        <state relative-caret-position="347">
630
+          <caret line="116" column="81" selection-start-line="116" selection-start-column="81" selection-end-line="116" selection-end-column="81" />
636 631
           <folding>
637 632
             <element signature="imports" expanded="true" />
638 633
             <element signature="e#244#245#0" expanded="true" />
639 634
             <element signature="e#286#287#0" expanded="true" />
640 635
             <element signature="e#310#311#0" expanded="true" />
641 636
             <element signature="e#348#349#0" expanded="true" />
642
-            <element signature="e#457#458#0" expanded="true" />
643
-            <element signature="e#485#486#0" expanded="true" />
644 637
             <element signature="e#817#818#0" expanded="true" />
645 638
             <element signature="e#844#845#0" expanded="true" />
646
-            <element signature="e#1819#1820#0" expanded="true" />
647
-            <element signature="e#1847#1848#0" expanded="true" />
648
-            <element signature="e#1907#1908#0" expanded="true" />
649
-            <element signature="e#1935#1936#0" expanded="true" />
650
-            <element signature="e#1997#1998#0" expanded="true" />
651
-            <element signature="e#2025#2026#0" expanded="true" />
652
-            <element signature="e#2082#2083#0" expanded="true" />
653
-            <element signature="e#2118#2119#0" expanded="true" />
639
+            <element signature="method#toArray#0;class#MySet#0" />
640
+            <element signature="method#add#0;class#MySet#0" />
641
+            <element signature="method#remove#0;class#MySet#0" />
642
+            <element signature="e#2975#2976#0" expanded="true" />
643
+            <element signature="e#3003#3004#0" expanded="true" />
644
+            <element signature="e#3063#3064#0" expanded="true" />
645
+            <element signature="e#3091#3092#0" expanded="true" />
646
+            <element signature="e#3153#3154#0" expanded="true" />
647
+            <element signature="e#3181#3182#0" expanded="true" />
648
+            <element signature="e#3238#3239#0" expanded="true" />
649
+            <element signature="e#3274#3275#0" expanded="true" />
654 650
           </folding>
655 651
         </state>
656 652
       </provider>
657 653
     </entry>
658 654
     <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
659 655
       <provider selected="true" editor-type-id="text-editor">
660
-        <state relative-caret-position="336">
661
-          <caret line="140" column="10" selection-start-line="140" selection-start-column="10" selection-end-line="140" selection-end-column="10" />
656
+        <state relative-caret-position="410">
657
+          <caret line="142" selection-start-line="142" selection-end-line="142" />
662 658
           <folding>
663 659
             <element signature="imports" expanded="true" />
664 660
             <element signature="e#1474#1480#0" expanded="true" />

+ 7
- 20
src/main/java/MySet.java Parādīt failu

@@ -109,31 +109,18 @@ public class MySet<T> extends MyArrayList implements Set {
109 109
 
110 110
     @Override
111 111
     public boolean addAll(Collection c) {
112
-
113
-        T[] newGenericSet = Arrays.copyOf(this.genericSet, size() + c.size());
114
-
115
-
116
-//        T[] newGenericSet = (T[]) Array.newInstance(this.genericSet.getClass().getComponentType(),
117
-//                genericSet.length + c.size());
118
-
119
-//        T[] cSet = (T[]) Array.newInstance(c.getClass().getComponentType(), c.size());
120
-
121
-//        int i = 0;
122
-//        for (T elem: genericSet) {
123
-//            newGenericSet[i] = elem;
124
-//            i++;
125
-//        }
112
+        T[] newGenericSet = Arrays.copyOf(this.genericSet, size());
126 113
 
127 114
         int i = size();
128
-
129 115
         for (Object elem: c) {
130
-            newGenericSet[i] = elem;
131
-            i++;
116
+            if (!this.contains(elem)){
117
+                newGenericSet = Arrays.copyOf(genericSet, genericSet.length + 1);
118
+                newGenericSet[i] = (T)elem;
119
+                genericSet = newGenericSet;
120
+                i++;
121
+            }
132 122
         }
133
-
134 123
         genericSet = newGenericSet;
135
-
136
-
137 124
         return false;
138 125
     }
139 126
 

+ 2
- 4
src/test/java/MySetTest.java Parādīt failu

@@ -130,16 +130,14 @@ public class MySetTest {
130 130
     @Test
131 131
     public void addAllLongTest() {
132 132
         // Given
133
-        Long[] expected = {1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L};
133
+        Long[] expected = {1L, 2L, 3L, 4L, 5L, 6L, 7L};
134 134
         Long[] inputArray = {1L, 2L, 3L, 4L};
135
-        //Long[] addAllArray = {5L, 6L, 7L, 8L};
136 135
         ArrayList<Long> addAllArray = new ArrayList<>();
137
-        addAllArray.add(5L); addAllArray.add(6L); addAllArray.add(7L); addAllArray.add(8L);
136
+        addAllArray.add(5L); addAllArray.add(6L); addAllArray.add(7L);  addAllArray.add(1L); addAllArray.add(7L);
138 137
 
139 138
         MySet<Long> mySet = new MySet<Long>(inputArray);
140 139
 
141 140
         // When
142
-        //mySet.addAll(Arrays.asList(addAllArray));
143 141
         mySet.addAll(addAllArray);
144 142
         Long[] actual = mySet.get();
145 143