Browse Source

myArrayList done

nafis nibir 6 years ago
parent
commit
53ce8bd379
3 changed files with 165 additions and 62 deletions
  1. 66
    61
      .idea/workspace.xml
  2. 31
    0
      src/main/java/MyArrayList.java
  3. 68
    1
      src/test/java/MyArrayListTest.java

+ 66
- 61
.idea/workspace.xml View File

@@ -20,10 +20,12 @@
20 20
           <file leaf-file-name="MyArrayList.java" pinned="false" current-in-tab="true">
21 21
             <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
22 22
               <provider selected="true" editor-type-id="text-editor">
23
-                <state relative-caret-position="492">
24
-                  <caret line="76" column="25" selection-start-line="76" selection-start-column="25" selection-end-line="76" selection-end-column="25" />
23
+                <state relative-caret-position="329">
24
+                  <caret line="104" column="25" selection-start-line="104" selection-start-column="25" selection-end-line="104" selection-end-column="25" />
25 25
                   <folding>
26 26
                     <element signature="imports" expanded="true" />
27
+                    <element signature="e#863#864#0" expanded="true" />
28
+                    <element signature="e#900#901#0" expanded="true" />
27 29
                     <element signature="e#1164#1165#0" expanded="true" />
28 30
                     <element signature="e#1200#1201#0" expanded="true" />
29 31
                   </folding>
@@ -34,8 +36,8 @@
34 36
           <file leaf-file-name="ArrayList.java" pinned="false" current-in-tab="false">
35 37
             <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
36 38
               <provider selected="true" editor-type-id="text-editor">
37
-                <state relative-caret-position="4307">
38
-                  <caret line="529" column="16" lean-forward="true" selection-start-line="529" selection-start-column="16" selection-end-line="529" selection-end-column="16" />
39
+                <state relative-caret-position="125">
40
+                  <caret line="549" column="44" selection-start-line="549" selection-start-column="39" selection-end-line="549" selection-end-column="44" />
39 41
                 </state>
40 42
               </provider>
41 43
             </entry>
@@ -47,8 +49,8 @@
47 49
           <file leaf-file-name="MyArrayListTest.java" pinned="false" current-in-tab="true">
48 50
             <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
49 51
               <provider selected="true" editor-type-id="text-editor">
50
-                <state relative-caret-position="569">
51
-                  <caret line="73" lean-forward="true" selection-start-line="73" selection-end-line="73" />
52
+                <state relative-caret-position="344">
53
+                  <caret line="128" column="37" lean-forward="true" selection-start-line="128" selection-start-column="37" selection-end-line="128" selection-end-column="37" />
52 54
                   <folding>
53 55
                     <element signature="imports" expanded="true" />
54 56
                     <element signature="e#184#193#0" expanded="true" />
@@ -71,6 +73,7 @@
71 73
   <component name="FindInProjectRecents">
72 74
     <findStrings>
73 75
       <find>remove</find>
76
+      <find>clear</find>
74 77
     </findStrings>
75 78
   </component>
76 79
   <component name="Git.Settings">
@@ -79,8 +82,8 @@
79 82
   <component name="IdeDocumentHistory">
80 83
     <option name="CHANGED_PATHS">
81 84
       <list>
82
-        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
83 85
         <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
86
+        <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
84 87
       </list>
85 88
     </option>
86 89
   </component>
@@ -182,17 +185,17 @@
182 185
       </list>
183 186
     </option>
184 187
   </component>
185
-  <component name="RunManager" selected="JUnit.MyArrayListTest.setTest">
188
+  <component name="RunManager" selected="JUnit.MyArrayListTest.sizeTest">
186 189
     <configuration default="true" type="Application" factoryName="Application">
187 190
       <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
188 191
     </configuration>
189
-    <configuration name="MyArrayListTest.get1Test" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
192
+    <configuration name="MyArrayListTest.containsTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
190 193
       <module name="generics" />
191 194
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
192 195
       <option name="ALTERNATIVE_JRE_PATH" />
193 196
       <option name="PACKAGE_NAME" value="" />
194 197
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
195
-      <option name="METHOD_NAME" value="get1Test" />
198
+      <option name="METHOD_NAME" value="containsTest" />
196 199
       <option name="TEST_OBJECT" value="method" />
197 200
       <option name="VM_PARAMETERS" value="-ea" />
198 201
       <option name="PARAMETERS" />
@@ -203,13 +206,13 @@
203 206
       </option>
204 207
       <patterns />
205 208
     </configuration>
206
-    <configuration name="MyArrayListTest.get2Test" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
209
+    <configuration name="MyArrayListTest.containsTest1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
207 210
       <module name="generics" />
208 211
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
209 212
       <option name="ALTERNATIVE_JRE_PATH" />
210 213
       <option name="PACKAGE_NAME" value="" />
211 214
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
212
-      <option name="METHOD_NAME" value="get2Test" />
215
+      <option name="METHOD_NAME" value="containsTest1" />
213 216
       <option name="TEST_OBJECT" value="method" />
214 217
       <option name="VM_PARAMETERS" value="-ea" />
215 218
       <option name="PARAMETERS" />
@@ -220,13 +223,13 @@
220 223
       </option>
221 224
       <patterns />
222 225
     </configuration>
223
-    <configuration name="MyArrayListTest.getTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
226
+    <configuration name="MyArrayListTest.isEmptyTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
224 227
       <module name="generics" />
225 228
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
226 229
       <option name="ALTERNATIVE_JRE_PATH" />
227 230
       <option name="PACKAGE_NAME" value="" />
228 231
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
229
-      <option name="METHOD_NAME" value="getTest" />
232
+      <option name="METHOD_NAME" value="isEmptyTest" />
230 233
       <option name="TEST_OBJECT" value="method" />
231 234
       <option name="VM_PARAMETERS" value="-ea" />
232 235
       <option name="PARAMETERS" />
@@ -237,13 +240,13 @@
237 240
       </option>
238 241
       <patterns />
239 242
     </configuration>
240
-    <configuration name="MyArrayListTest.removeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
243
+    <configuration name="MyArrayListTest.isEmptyTest1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
241 244
       <module name="generics" />
242 245
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
243 246
       <option name="ALTERNATIVE_JRE_PATH" />
244 247
       <option name="PACKAGE_NAME" value="" />
245 248
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
246
-      <option name="METHOD_NAME" value="removeTest" />
249
+      <option name="METHOD_NAME" value="isEmptyTest1" />
247 250
       <option name="TEST_OBJECT" value="method" />
248 251
       <option name="VM_PARAMETERS" value="-ea" />
249 252
       <option name="PARAMETERS" />
@@ -254,13 +257,13 @@
254 257
       </option>
255 258
       <patterns />
256 259
     </configuration>
257
-    <configuration name="MyArrayListTest.setTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
260
+    <configuration name="MyArrayListTest.sizeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
258 261
       <module name="generics" />
259 262
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
260 263
       <option name="ALTERNATIVE_JRE_PATH" />
261 264
       <option name="PACKAGE_NAME" value="" />
262 265
       <option name="MAIN_CLASS_NAME" value="MyArrayListTest" />
263
-      <option name="METHOD_NAME" value="setTest" />
266
+      <option name="METHOD_NAME" value="sizeTest" />
264 267
       <option name="TEST_OBJECT" value="method" />
265 268
       <option name="VM_PARAMETERS" value="-ea" />
266 269
       <option name="PARAMETERS" />
@@ -310,19 +313,19 @@
310 313
       <listeners />
311 314
     </configuration>
312 315
     <list>
313
-      <item itemvalue="JUnit.MyArrayListTest.getTest" />
314
-      <item itemvalue="JUnit.MyArrayListTest.get1Test" />
315
-      <item itemvalue="JUnit.MyArrayListTest.get2Test" />
316
-      <item itemvalue="JUnit.MyArrayListTest.removeTest" />
317
-      <item itemvalue="JUnit.MyArrayListTest.setTest" />
316
+      <item itemvalue="JUnit.MyArrayListTest.isEmptyTest" />
317
+      <item itemvalue="JUnit.MyArrayListTest.isEmptyTest1" />
318
+      <item itemvalue="JUnit.MyArrayListTest.containsTest" />
319
+      <item itemvalue="JUnit.MyArrayListTest.containsTest1" />
320
+      <item itemvalue="JUnit.MyArrayListTest.sizeTest" />
318 321
     </list>
319 322
     <recent_temporary>
320 323
       <list>
321
-        <item itemvalue="JUnit.MyArrayListTest.setTest" />
322
-        <item itemvalue="JUnit.MyArrayListTest.removeTest" />
323
-        <item itemvalue="JUnit.MyArrayListTest.get2Test" />
324
-        <item itemvalue="JUnit.MyArrayListTest.get1Test" />
325
-        <item itemvalue="JUnit.MyArrayListTest.getTest" />
324
+        <item itemvalue="JUnit.MyArrayListTest.sizeTest" />
325
+        <item itemvalue="JUnit.MyArrayListTest.containsTest1" />
326
+        <item itemvalue="JUnit.MyArrayListTest.containsTest" />
327
+        <item itemvalue="JUnit.MyArrayListTest.isEmptyTest1" />
328
+        <item itemvalue="JUnit.MyArrayListTest.isEmptyTest" />
326 329
       </list>
327 330
     </recent_temporary>
328 331
   </component>
@@ -337,44 +340,44 @@
337 340
       <option name="presentableId" value="Default" />
338 341
       <updated>1530106571709</updated>
339 342
       <workItem from="1530106581652" duration="58000" />
340
-      <workItem from="1530122909636" duration="10967000" />
343
+      <workItem from="1530122909636" duration="12816000" />
341 344
     </task>
342 345
     <servers />
343 346
   </component>
344 347
   <component name="TestHistory">
345
-    <history-entry file="MyArrayListTest_add1Test - 2018.06.27 at 16h 22m 27s.xml">
346
-      <configuration name="MyArrayListTest.add1Test" configurationId="JUnit" />
348
+    <history-entry file="MyArrayListTest_setTest1 - 2018.06.27 at 18h 51m 39s.xml">
349
+      <configuration name="MyArrayListTest.setTest1" configurationId="JUnit" />
347 350
     </history-entry>
348
-    <history-entry file="MyArrayListTest_getTest - 2018.06.27 at 16h 37m 49s.xml">
349
-      <configuration name="MyArrayListTest.getTest" configurationId="JUnit" />
351
+    <history-entry file="MyArrayListTest_setTest1 - 2018.06.27 at 18h 52m 26s.xml">
352
+      <configuration name="MyArrayListTest.setTest1" configurationId="JUnit" />
350 353
     </history-entry>
351
-    <history-entry file="MyArrayListTest_getTest - 2018.06.27 at 16h 39m 28s.xml">
352
-      <configuration name="MyArrayListTest.getTest" configurationId="JUnit" />
354
+    <history-entry file="MyArrayListTest_setTest1 - 2018.06.27 at 18h 52m 45s.xml">
355
+      <configuration name="MyArrayListTest.setTest1" configurationId="JUnit" />
353 356
     </history-entry>
354
-    <history-entry file="MyArrayListTest_get1Test - 2018.06.27 at 16h 39m 58s.xml">
355
-      <configuration name="MyArrayListTest.get1Test" configurationId="JUnit" />
357
+    <history-entry file="MyArrayListTest_clearTest - 2018.06.27 at 19h 05m 27s.xml">
358
+      <configuration name="MyArrayListTest.clearTest" configurationId="JUnit" />
356 359
     </history-entry>
357
-    <history-entry file="MyArrayListTest_get1Test - 2018.06.27 at 16h 40m 04s.xml">
358
-      <configuration name="MyArrayListTest.get1Test" configurationId="JUnit" />
360
+    <history-entry file="MyArrayListTest_clearTest - 2018.06.27 at 19h 05m 47s.xml">
361
+      <configuration name="MyArrayListTest.clearTest" configurationId="JUnit" />
359 362
     </history-entry>
360
-    <history-entry file="MyArrayListTest_get2Test - 2018.06.27 at 16h 42m 41s.xml">
361
-      <configuration name="MyArrayListTest.get2Test" configurationId="JUnit" />
363
+    <history-entry file="MyArrayListTest_clearTest - 2018.06.27 at 19h 06m 03s.xml">
364
+      <configuration name="MyArrayListTest.clearTest" configurationId="JUnit" />
362 365
     </history-entry>
363
-    <history-entry file="MyArrayListTest_get2Test - 2018.06.27 at 16h 45m 56s.xml">
364
-      <configuration name="MyArrayListTest.get2Test" configurationId="JUnit" />
366
+    <history-entry file="MyArrayListTest_isEmptyTest - 2018.06.27 at 19h 09m 07s.xml">
367
+      <configuration name="MyArrayListTest.isEmptyTest" configurationId="JUnit" />
365 368
     </history-entry>
366
-    <history-entry file="MyArrayListTest_removeTest - 2018.06.27 at 17h 07m 04s.xml">
367
-      <configuration name="MyArrayListTest.removeTest" configurationId="JUnit" />
369
+    <history-entry file="MyArrayListTest_isEmptyTest - 2018.06.27 at 19h 09m 35s.xml">
370
+      <configuration name="MyArrayListTest.isEmptyTest" configurationId="JUnit" />
368 371
     </history-entry>
369
-    <history-entry file="MyArrayListTest_removeTest - 2018.06.27 at 17h 11m 14s.xml">
370
-      <configuration name="MyArrayListTest.removeTest" configurationId="JUnit" />
372
+    <history-entry file="MyArrayListTest_isEmptyTest1 - 2018.06.27 at 19h 09m 57s.xml">
373
+      <configuration name="MyArrayListTest.isEmptyTest1" configurationId="JUnit" />
371 374
     </history-entry>
372
-    <history-entry file="MyArrayListTest_removeTest - 2018.06.27 at 17h 11m 25s.xml">
373
-      <configuration name="MyArrayListTest.removeTest" configurationId="JUnit" />
375
+    <history-entry file="MyArrayListTest_containsTest - 2018.06.27 at 19h 12m 33s.xml">
376
+      <configuration name="MyArrayListTest.containsTest" configurationId="JUnit" />
374 377
     </history-entry>
375 378
   </component>
376 379
   <component name="TimeTrackingManager">
377
-    <option name="totallyTimeSpent" value="11025000" />
380
+    <option name="totallyTimeSpent" value="12874000" />
378 381
   </component>
379 382
   <component name="ToolWindowManager">
380 383
     <frame x="-208" y="-927" width="1881" height="941" extended-state="0" />
@@ -382,14 +385,14 @@
382 385
     <layout>
383 386
       <window_info anchor="right" id="Palette" order="3" />
384 387
       <window_info anchor="bottom" id="TODO" order="6" />
385
-      <window_info anchor="bottom" id="Messages" weight="0.06942753" />
388
+      <window_info anchor="bottom" id="Messages" weight="0.24238734" />
386 389
       <window_info anchor="right" id="Palette&#9;" order="3" />
387 390
       <window_info id="Image Layers" order="2" />
388 391
       <window_info anchor="right" id="Capture Analysis" order="3" />
389 392
       <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
390 393
       <window_info anchor="right" id="Maven Projects" order="3" />
391 394
       <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
392
-      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.12423874" />
395
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3227771" />
393 396
       <window_info anchor="bottom" id="Version Control" order="7" />
394 397
       <window_info anchor="bottom" id="Terminal" order="7" weight="0.32886723" />
395 398
       <window_info id="Capture Tool" order="2" />
@@ -418,7 +421,7 @@
418 421
   </component>
419 422
   <component name="XDebuggerManager">
420 423
     <breakpoint-manager>
421
-      <option name="time" value="1" />
424
+      <option name="time" value="2" />
422 425
     </breakpoint-manager>
423 426
   </component>
424 427
   <component name="editorHistoryManager">
@@ -434,17 +437,19 @@
434 437
     </entry>
435 438
     <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
436 439
       <provider selected="true" editor-type-id="text-editor">
437
-        <state relative-caret-position="4307">
438
-          <caret line="529" column="16" lean-forward="true" selection-start-line="529" selection-start-column="16" selection-end-line="529" selection-end-column="16" />
440
+        <state relative-caret-position="125">
441
+          <caret line="549" column="44" selection-start-line="549" selection-start-column="39" selection-end-line="549" selection-end-column="44" />
439 442
         </state>
440 443
       </provider>
441 444
     </entry>
442 445
     <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
443 446
       <provider selected="true" editor-type-id="text-editor">
444
-        <state relative-caret-position="492">
445
-          <caret line="76" column="25" selection-start-line="76" selection-start-column="25" selection-end-line="76" selection-end-column="25" />
447
+        <state relative-caret-position="329">
448
+          <caret line="104" column="25" selection-start-line="104" selection-start-column="25" selection-end-line="104" selection-end-column="25" />
446 449
           <folding>
447 450
             <element signature="imports" expanded="true" />
451
+            <element signature="e#863#864#0" expanded="true" />
452
+            <element signature="e#900#901#0" expanded="true" />
448 453
             <element signature="e#1164#1165#0" expanded="true" />
449 454
             <element signature="e#1200#1201#0" expanded="true" />
450 455
           </folding>
@@ -453,8 +458,8 @@
453 458
     </entry>
454 459
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
455 460
       <provider selected="true" editor-type-id="text-editor">
456
-        <state relative-caret-position="569">
457
-          <caret line="73" lean-forward="true" selection-start-line="73" selection-end-line="73" />
461
+        <state relative-caret-position="344">
462
+          <caret line="128" column="37" lean-forward="true" selection-start-line="128" selection-start-column="37" selection-end-line="128" selection-end-column="37" />
458 463
           <folding>
459 464
             <element signature="imports" expanded="true" />
460 465
             <element signature="e#184#193#0" expanded="true" />
@@ -479,7 +484,7 @@
479 484
       </state>
480 485
       <state key="FacetStructureConfigurable.UI">
481 486
         <settings>
482
-          <last-edited>No facets are configured</last-edited>
487
+          <last-edited />
483 488
           <splitter-proportions>
484 489
             <option name="proportions">
485 490
               <list>
@@ -539,7 +544,7 @@
539 544
       </state>
540 545
       <state key="ProjectLibrariesConfigurable.UI">
541 546
         <settings>
542
-          <last-edited>Maven: junit:junit:4.12</last-edited>
547
+          <last-edited />
543 548
           <splitter-proportions>
544 549
             <option name="proportions">
545 550
               <list>

+ 31
- 0
src/main/java/MyArrayList.java View File

@@ -37,6 +37,10 @@ public class MyArrayList <T>{
37 37
         }
38 38
     }
39 39
 
40
+    public int sizeWithNull(){
41
+        return element.length;
42
+    }
43
+
40 44
     public int size(){
41 45
         long size = Arrays.stream(element)
42 46
                           .filter(s -> (s != null))
@@ -79,4 +83,31 @@ public class MyArrayList <T>{
79 83
         element = new Object[element.length+i];
80 84
         arrCopy(element, temp);
81 85
     }
86
+
87
+    public void clear() {
88
+        for(int i = 0; i < element.length; i++){
89
+            element[i] = null;
90
+        }
91
+    }
92
+
93
+    public boolean isEmpty() {
94
+        for(Object o: element){
95
+            if (!(o ==null)){
96
+                return false;
97
+            }
98
+        }
99
+        return true;
100
+    }
101
+
102
+    public boolean contains(T i) {
103
+        for(Object o: element){
104
+            if(o == null){
105
+                continue;
106
+            }
107
+            if (o.equals(i)){
108
+                return true;
109
+            }
110
+        }
111
+        return false;
112
+    }
82 113
 }

+ 68
- 1
src/test/java/MyArrayListTest.java View File

@@ -73,22 +73,89 @@ public class MyArrayListTest {
73 73
     }
74 74
 
75 75
     @Test
76
+    public void setTest1(){
77
+        MyArrayList<String> myArrayList = new MyArrayList<>();
78
+        myArrayList.set(12, "dog");
79
+        myArrayList.set(2, "cat");
80
+        String expected = "cat";
81
+        int expectedSize = 22;
82
+        String actual = myArrayList.get(2);
83
+        Assert.assertEquals(expected, actual);
84
+        Assert.assertTrue(expectedSize == myArrayList.sizeWithNull());
85
+    }
86
+
87
+    @Test
88
+    public void arrayExpanderTest(){
89
+        MyArrayList<String> myArrayList = new MyArrayList<>();
90
+        myArrayList.arrayExpander(2);
91
+        int expected = 12;
92
+        int actual = myArrayList.sizeWithNull();
93
+        Assert.assertEquals(expected, actual);
94
+    }
95
+
96
+    @Test
76 97
     public void clearTest(){
98
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
99
+        myArrayList.add(2);
100
+        myArrayList.add(3);
101
+        myArrayList.clear();
102
+        Integer expected = null;
103
+        Integer sizeExpected = 10;
104
+        Assert.assertEquals(expected, myArrayList.get(1));
105
+        Assert.assertTrue(sizeExpected == myArrayList.sizeWithNull());
77 106
 
78 107
     }
79 108
 
80 109
     @Test
81 110
     public void isEmptyTest(){
111
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
112
+        boolean actual = myArrayList.isEmpty();
113
+        Assert.assertTrue(actual);
114
+    }
82 115
 
116
+    @Test
117
+    public void isEmptyTest1(){
118
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
119
+        myArrayList.add(1);
120
+        boolean actual = myArrayList.isEmpty();
121
+        Assert.assertFalse(actual);
83 122
     }
84 123
 
85 124
     @Test
86 125
     public void containsTest(){
126
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
127
+        myArrayList.add(1);
128
+        boolean contains = myArrayList.contains(3);
129
+        Assert.assertFalse(contains);
130
+    }
87 131
 
132
+    @Test
133
+    public void containsTest1(){
134
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
135
+        myArrayList.add(1);
136
+        myArrayList.add(1);
137
+        myArrayList.add(4);
138
+        myArrayList.add(1);
139
+        myArrayList.add(1);
140
+        myArrayList.add(1);
141
+        boolean contains = myArrayList.contains(4);
142
+        Assert.assertTrue(contains);
88 143
     }
89 144
 
90 145
     @Test
91 146
     public void sizeTest(){
92
-
147
+        MyArrayList<Integer> myArrayList = new MyArrayList<>();
148
+        myArrayList.add(1);
149
+        myArrayList.add(1);
150
+        myArrayList.add(4);
151
+        myArrayList.add(1);
152
+        myArrayList.add(1);
153
+        myArrayList.add(1);
154
+        myArrayList.add(1);
155
+        myArrayList.add(1);
156
+        myArrayList.add(1);
157
+        myArrayList.add(1);
158
+        myArrayList.add(1);
159
+        Assert.assertTrue(myArrayList.size() == 11);
93 160
     }
94 161
 }