Explorar el Código

completed this lab

thulasi hace 6 años
padre
commit
48e84b4798
Se han modificado 2 ficheros con 131 adiciones y 77 borrados
  1. 129
    75
      .idea/workspace.xml
  2. 2
    2
      src/main/java/MySet.java

+ 129
- 75
.idea/workspace.xml Ver fichero

@@ -2,10 +2,7 @@
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/MyArrayList.java" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
7
-      <change afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
8
-      <change afterPath="$PROJECT_DIR$/src/test/java/MySetTest.java" afterDir="false" />
5
+      <change beforePath="$PROJECT_DIR$/src/main/java/MySet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MySet.java" afterDir="false" />
9 6
     </list>
10 7
     <ignored path="$PROJECT_DIR$/target/" />
11 8
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -24,24 +21,24 @@
24 21
       </usages-collector>
25 22
       <usages-collector id="statistics.file.extensions.open">
26 23
         <counts>
27
-          <entry key="class" value="1" />
24
+          <entry key="class" value="12" />
28 25
           <entry key="java" value="5" />
29 26
         </counts>
30 27
       </usages-collector>
31 28
       <usages-collector id="statistics.file.types.open">
32 29
         <counts>
33
-          <entry key="CLASS" value="1" />
30
+          <entry key="CLASS" value="12" />
34 31
           <entry key="JAVA" value="5" />
35 32
         </counts>
36 33
       </usages-collector>
37 34
       <usages-collector id="statistics.file.extensions.edit">
38 35
         <counts>
39
-          <entry key="java" value="2576" />
36
+          <entry key="java" value="2687" />
40 37
         </counts>
41 38
       </usages-collector>
42 39
       <usages-collector id="statistics.file.types.edit">
43 40
         <counts>
44
-          <entry key="JAVA" value="2576" />
41
+          <entry key="JAVA" value="2687" />
45 42
         </counts>
46 43
       </usages-collector>
47 44
     </session>
@@ -71,8 +68,8 @@
71 68
       <file pinned="false" current-in-tab="false">
72 69
         <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
73 70
           <provider selected="true" editor-type-id="text-editor">
74
-            <state relative-caret-position="322">
75
-              <caret line="91" column="1" lean-forward="true" selection-end-line="91" selection-end-column="1" />
71
+            <state relative-caret-position="150">
72
+              <caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
76 73
               <folding>
77 74
                 <element signature="imports" expanded="true" />
78 75
               </folding>
@@ -83,8 +80,8 @@
83 80
       <file pinned="false" current-in-tab="false">
84 81
         <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
85 82
           <provider selected="true" editor-type-id="text-editor">
86
-            <state relative-caret-position="183">
87
-              <caret line="19" selection-start-line="19" selection-end-line="19" />
83
+            <state relative-caret-position="123">
84
+              <caret line="76" selection-start-line="76" selection-end-line="76" />
88 85
               <folding>
89 86
                 <element signature="e#131#132#0" expanded="true" />
90 87
                 <element signature="e#175#176#0" expanded="true" />
@@ -92,21 +89,27 @@
92 89
                 <element signature="e#258#259#0" expanded="true" />
93 90
                 <element signature="e#1625#1626#0" expanded="true" />
94 91
                 <element signature="e#1718#1719#0" expanded="true" />
95
-                <element signature="e#2068#2069#0" expanded="true" />
96
-                <element signature="e#2106#2107#0" expanded="true" />
92
+                <element signature="e#2123#2124#0" expanded="true" />
93
+                <element signature="e#2161#2162#0" expanded="true" />
97 94
               </folding>
98 95
             </state>
99 96
           </provider>
100 97
         </entry>
101 98
       </file>
102 99
       <file pinned="false" current-in-tab="true">
103
-        <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
100
+        <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
104 101
           <provider selected="true" editor-type-id="text-editor">
105
-            <state relative-caret-position="1290">
106
-              <caret line="86" selection-start-line="86" selection-end-line="86" />
107
-              <folding>
108
-                <element signature="imports" expanded="true" />
109
-              </folding>
102
+            <state relative-caret-position="210">
103
+              <caret line="17" selection-start-line="17" selection-end-line="17" />
104
+            </state>
105
+          </provider>
106
+        </entry>
107
+      </file>
108
+      <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">
110
+          <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" />
110 113
             </state>
111 114
           </provider>
112 115
         </entry>
@@ -242,7 +245,7 @@
242 245
   <component name="PropertiesComponent">
243 246
     <property name="WebServerToolWindowFactoryState" value="false" />
244 247
     <property name="aspect.path.notification.shown" value="true" />
245
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542167013031" />
248
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542227780702" />
246 249
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
247 250
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
248 251
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -278,48 +281,48 @@
278 281
         <option name="Make" enabled="true" />
279 282
       </method>
280 283
     </configuration>
281
-    <configuration name="MyArrayListTest.testRemove2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
284
+    <configuration name="MyArrayListTest.testSet" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
282 285
       <module name="generics" />
283 286
       <option name="PACKAGE_NAME" value="" />
284 287
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
285
-      <option name="METHOD_NAME" value="testRemove2" />
288
+      <option name="METHOD_NAME" value="testSet" />
286 289
       <option name="TEST_OBJECT" value="method" />
287 290
       <method v="2">
288 291
         <option name="Make" enabled="true" />
289 292
       </method>
290 293
     </configuration>
291
-    <configuration name="MyArrayListTest.testSet" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
294
+    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
292 295
       <module name="generics" />
293 296
       <option name="PACKAGE_NAME" value="" />
294
-      <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
295
-      <option name="METHOD_NAME" value="testSet" />
296
-      <option name="TEST_OBJECT" value="method" />
297
+      <option name="MAIN_CLASS_NAME" value="MySetTest" />
297 298
       <method v="2">
298 299
         <option name="Make" enabled="true" />
299 300
       </method>
300 301
     </configuration>
301
-    <configuration name="MySetTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
302
+    <configuration name="MySetTest.testAddAtIndex" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
302 303
       <module name="generics" />
303 304
       <option name="PACKAGE_NAME" value="" />
304 305
       <option name="MAIN_CLASS_NAME" value="MySetTest" />
306
+      <option name="METHOD_NAME" value="testAddAtIndex" />
307
+      <option name="TEST_OBJECT" value="method" />
305 308
       <method v="2">
306 309
         <option name="Make" enabled="true" />
307 310
       </method>
308 311
     </configuration>
309 312
     <list>
310 313
       <item itemvalue="JUnit.MyArrayListTest" />
311
-      <item itemvalue="JUnit.MyArrayListTest.testRemove2" />
312 314
       <item itemvalue="JUnit.MyArrayListTest.testSet" />
313 315
       <item itemvalue="JUnit.MyArrayListTest.testAddAtIndex" />
314 316
       <item itemvalue="JUnit.MySetTest" />
317
+      <item itemvalue="JUnit.MySetTest.testAddAtIndex" />
315 318
     </list>
316 319
     <recent_temporary>
317 320
       <list>
318 321
         <item itemvalue="JUnit.MySetTest" />
322
+        <item itemvalue="JUnit.MySetTest.testAddAtIndex" />
319 323
         <item itemvalue="JUnit.MyArrayListTest.testAddAtIndex" />
320 324
         <item itemvalue="JUnit.MyArrayListTest" />
321 325
         <item itemvalue="JUnit.MyArrayListTest.testSet" />
322
-        <item itemvalue="JUnit.MyArrayListTest.testRemove2" />
323 326
       </list>
324 327
     </recent_temporary>
325 328
   </component>
@@ -333,48 +336,47 @@
333 336
       <option name="number" value="Default" />
334 337
       <option name="presentableId" value="Default" />
335 338
       <updated>1542144297867</updated>
336
-      <workItem from="1542144301266" duration="15755000" />
339
+      <workItem from="1542144301266" duration="23107000" />
337 340
     </task>
338 341
     <servers />
339 342
   </component>
340 343
   <component name="TestHistory">
341
-    <history-entry file="MyArrayListTest - 2018.11.13 at 21h 55m 32s.xml">
342
-      <configuration name="MyArrayListTest" configurationId="JUnit" />
344
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 09h 05m 29s.xml">
345
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
343 346
     </history-entry>
344
-    <history-entry file="MyArrayListTest_testAddAtIndex - 2018.11.13 at 22h 03m 47s.xml">
345
-      <configuration name="MyArrayListTest.testAddAtIndex" configurationId="JUnit" />
347
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 49m 10s.xml">
348
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
346 349
     </history-entry>
347
-    <history-entry file="MyArrayListTest_testAddAtIndex - 2018.11.13 at 22h 04m 45s.xml">
348
-      <configuration name="MyArrayListTest.testAddAtIndex" configurationId="JUnit" />
350
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 49m 56s.xml">
351
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
349 352
     </history-entry>
350
-    <history-entry file="MyArrayListTest_testAddAtIndex - 2018.11.13 at 22h 13m 22s.xml">
351
-      <configuration name="MyArrayListTest.testAddAtIndex" configurationId="JUnit" />
353
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 51m 01s.xml">
354
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
352 355
     </history-entry>
353
-    <history-entry file="MyArrayListTest_testAddAtIndex - 2018.11.13 at 22h 16m 48s.xml">
354
-      <configuration name="MyArrayListTest.testAddAtIndex" configurationId="JUnit" />
356
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 52m 14s.xml">
357
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
355 358
     </history-entry>
356
-    <history-entry file="MySetTest - 2018.11.13 at 22h 34m 46s.xml">
357
-      <configuration name="MySetTest" configurationId="JUnit" />
359
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 14h 54m 05s.xml">
360
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
358 361
     </history-entry>
359
-    <history-entry file="MySetTest - 2018.11.13 at 22h 40m 00s.xml">
360
-      <configuration name="MySetTest" configurationId="JUnit" />
362
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 26m 58s.xml">
363
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
361 364
     </history-entry>
362
-    <history-entry file="MySetTest - 2018.11.13 at 22h 41m 16s.xml">
363
-      <configuration name="MySetTest" configurationId="JUnit" />
365
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 37s.xml">
366
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
364 367
     </history-entry>
365
-    <history-entry file="MySetTest - 2018.11.13 at 22h 42m 39s.xml">
366
-      <configuration name="MySetTest" configurationId="JUnit" />
368
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 34m 47s.xml">
369
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
367 370
     </history-entry>
368
-    <history-entry file="MySetTest - 2018.11.13 at 22h 43m 32s.xml">
369
-      <configuration name="MySetTest" configurationId="JUnit" />
371
+    <history-entry file="MySetTest_testAddAtIndex - 2018.11.14 at 15h 35m 23s.xml">
372
+      <configuration name="MySetTest.testAddAtIndex" configurationId="JUnit" />
370 373
     </history-entry>
371 374
   </component>
372 375
   <component name="TimeTrackingManager">
373
-    <option name="totallyTimeSpent" value="15755000" />
376
+    <option name="totallyTimeSpent" value="23107000" />
374 377
   </component>
375 378
   <component name="ToolWindowManager">
376 379
     <frame x="0" y="23" width="1280" height="709" extended-state="0" />
377
-    <editor active="true" />
378 380
     <layout>
379 381
       <window_info id="Image Layers" />
380 382
       <window_info id="Designer" />
@@ -386,7 +388,7 @@
386 388
       <window_info anchor="bottom" id="Messages" weight="0.32901135" />
387 389
       <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
388 390
       <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
389
-      <window_info anchor="bottom" id="Terminal" />
391
+      <window_info anchor="bottom" id="Terminal" weight="0.32901135" />
390 392
       <window_info anchor="bottom" id="Event Log" side_tool="true" />
391 393
       <window_info anchor="bottom" id="Message" order="0" />
392 394
       <window_info anchor="bottom" id="Find" order="1" weight="0.32901135" />
@@ -447,9 +449,33 @@
447 449
       <breakpoints>
448 450
         <line-breakpoint enabled="true" type="java-line">
449 451
           <url>file://$PROJECT_DIR$/src/main/java/MySet.java</url>
450
-          <line>76</line>
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>
451 465
           <properties />
452
-          <option name="timeStamp" value="2" />
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" />
453 479
         </line-breakpoint>
454 480
       </breakpoints>
455 481
     </breakpoint-manager>
@@ -473,20 +499,58 @@
473 499
         </state>
474 500
       </provider>
475 501
     </entry>
502
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/model/FrameworkMethod.class">
503
+      <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" />
506
+        </state>
507
+      </provider>
508
+    </entry>
476 509
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
477 510
       <provider selected="true" editor-type-id="text-editor">
478
-        <state relative-caret-position="322">
479
-          <caret line="91" column="1" lean-forward="true" selection-end-line="91" selection-end-column="1" />
511
+        <state relative-caret-position="150">
512
+          <caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
480 513
           <folding>
481 514
             <element signature="imports" expanded="true" />
482 515
           </folding>
483 516
         </state>
484 517
       </provider>
485 518
     </entry>
519
+    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
520
+      <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" />
523
+          <folding>
524
+            <element signature="imports" expanded="true" />
525
+          </folding>
526
+        </state>
527
+      </provider>
528
+    </entry>
529
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runner/JUnitCore.class">
530
+      <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" />
533
+        </state>
534
+      </provider>
535
+    </entry>
536
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/BlockJUnit4ClassRunner.class">
537
+      <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" />
540
+        </state>
541
+      </provider>
542
+    </entry>
543
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/ParentRunner.class">
544
+      <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" />
547
+        </state>
548
+      </provider>
549
+    </entry>
486 550
     <entry file="file://$PROJECT_DIR$/src/main/java/MySet.java">
487 551
       <provider selected="true" editor-type-id="text-editor">
488
-        <state relative-caret-position="183">
489
-          <caret line="19" selection-start-line="19" selection-end-line="19" />
552
+        <state relative-caret-position="123">
553
+          <caret line="76" selection-start-line="76" selection-end-line="76" />
490 554
           <folding>
491 555
             <element signature="e#131#132#0" expanded="true" />
492 556
             <element signature="e#175#176#0" expanded="true" />
@@ -494,26 +558,16 @@
494 558
             <element signature="e#258#259#0" expanded="true" />
495 559
             <element signature="e#1625#1626#0" expanded="true" />
496 560
             <element signature="e#1718#1719#0" expanded="true" />
497
-            <element signature="e#2068#2069#0" expanded="true" />
498
-            <element signature="e#2106#2107#0" expanded="true" />
561
+            <element signature="e#2123#2124#0" expanded="true" />
562
+            <element signature="e#2161#2162#0" expanded="true" />
499 563
           </folding>
500 564
         </state>
501 565
       </provider>
502 566
     </entry>
503
-    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/runners/model/FrameworkMethod.class">
504
-      <provider selected="true" editor-type-id="text-editor">
505
-        <state relative-caret-position="220">
506
-          <caret line="56" column="9" lean-forward="true" selection-start-line="56" selection-start-column="9" selection-end-line="56" selection-end-column="9" />
507
-        </state>
508
-      </provider>
509
-    </entry>
510
-    <entry file="file://$PROJECT_DIR$/src/test/java/MySetTest.java">
567
+    <entry file="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
511 568
       <provider selected="true" editor-type-id="text-editor">
512
-        <state relative-caret-position="1290">
513
-          <caret line="86" selection-start-line="86" selection-end-line="86" />
514
-          <folding>
515
-            <element signature="imports" expanded="true" />
516
-          </folding>
569
+        <state relative-caret-position="210">
570
+          <caret line="17" selection-start-line="17" selection-end-line="17" />
517 571
         </state>
518 572
       </provider>
519 573
     </entry>

+ 2
- 2
src/main/java/MySet.java Ver fichero

@@ -73,8 +73,8 @@ public class MySet<E> {
73 73
 
74 74
     public boolean contains(Object element)
75 75
     {
76
-        for(int i=0; i<set.length; i++){
77
-            if(set[i].equals(element)) {
76
+        for(Object o : set) {
77
+            if(element.equals(o)) {
78 78
                 return true;
79 79
             }
80 80
         }