Seth 6 years ago
parent
commit
43a08eba20

+ 18
- 31
.idea/workspace.xml View File

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="7ad04558-d1a8-448f-add7-490f9c754201" name="Default Changelist" comment="">
4
     <list default="true" id="7ad04558-d1a8-448f-add7-490f9c754201" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
5
       <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
7
       <change beforePath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
7
     </list>
8
     </list>
36
       </usages-collector>
37
       </usages-collector>
37
       <usages-collector id="statistics.file.extensions.edit">
38
       <usages-collector id="statistics.file.extensions.edit">
38
         <counts>
39
         <counts>
39
-          <entry key="java" value="3332" />
40
+          <entry key="java" value="3540" />
40
         </counts>
41
         </counts>
41
       </usages-collector>
42
       </usages-collector>
42
       <usages-collector id="statistics.file.types.edit">
43
       <usages-collector id="statistics.file.types.edit">
43
         <counts>
44
         <counts>
44
-          <entry key="JAVA" value="3332" />
45
+          <entry key="JAVA" value="3540" />
45
         </counts>
46
         </counts>
46
       </usages-collector>
47
       </usages-collector>
47
     </session>
48
     </session>
51
       <file pinned="false" current-in-tab="false">
52
       <file pinned="false" current-in-tab="false">
52
         <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
53
         <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
53
           <provider selected="true" editor-type-id="text-editor">
54
           <provider selected="true" editor-type-id="text-editor">
54
-            <state relative-caret-position="-7">
55
-              <caret line="134" column="23" lean-forward="true" selection-start-line="134" selection-start-column="23" selection-end-line="134" selection-end-column="23" />
55
+            <state relative-caret-position="-2282">
56
+              <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
56
               <folding>
57
               <folding>
57
                 <element signature="imports" expanded="true" />
58
                 <element signature="imports" expanded="true" />
58
                 <element signature="e#143#144#0" expanded="true" />
59
                 <element signature="e#143#144#0" expanded="true" />
65
       <file pinned="false" current-in-tab="true">
66
       <file pinned="false" current-in-tab="true">
66
         <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
67
         <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
67
           <provider selected="true" editor-type-id="text-editor">
68
           <provider selected="true" editor-type-id="text-editor">
68
-            <state relative-caret-position="332">
69
-              <caret line="71" selection-start-line="71" selection-end-line="71" />
69
+            <state relative-caret-position="-722">
70
+              <caret line="3" column="26" selection-start-line="3" selection-start-column="26" selection-end-line="3" selection-end-column="26" />
70
               <folding>
71
               <folding>
71
                 <element signature="e#729#730#0" expanded="true" />
72
                 <element signature="e#729#730#0" expanded="true" />
72
                 <element signature="e#763#764#0" expanded="true" />
73
                 <element signature="e#763#764#0" expanded="true" />
94
   <component name="IdeDocumentHistory">
95
   <component name="IdeDocumentHistory">
95
     <option name="CHANGED_PATHS">
96
     <option name="CHANGED_PATHS">
96
       <list>
97
       <list>
97
-        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
98
         <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
98
         <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
99
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
99
       </list>
100
       </list>
100
     </option>
101
     </option>
101
   </component>
102
   </component>
165
   <component name="PropertiesComponent">
166
   <component name="PropertiesComponent">
166
     <property name="WebServerToolWindowFactoryState" value="false" />
167
     <property name="WebServerToolWindowFactoryState" value="false" />
167
     <property name="aspect.path.notification.shown" value="true" />
168
     <property name="aspect.path.notification.shown" value="true" />
168
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542200951534" />
169
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542219251358" />
169
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
170
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
170
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
171
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
171
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
172
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
259
       <option name="number" value="Default" />
260
       <option name="number" value="Default" />
260
       <option name="presentableId" value="Default" />
261
       <option name="presentableId" value="Default" />
261
       <updated>1542149227412</updated>
262
       <updated>1542149227412</updated>
262
-      <workItem from="1542149228819" duration="10441000" />
263
+      <workItem from="1542149228819" duration="13060000" />
263
     </task>
264
     </task>
264
     <servers />
265
     <servers />
265
   </component>
266
   </component>
266
   <component name="TestHistory">
267
   <component name="TestHistory">
267
-    <history-entry file="MyArrayListTest_setTest - 2018.11.13 at 19h 50m 07s.xml">
268
-      <configuration name="MyArrayListTest.setTest" configurationId="JUnit" />
269
-    </history-entry>
270
     <history-entry file="MyArrayListTest_addAtIndexTest - 2018.11.13 at 19h 50m 15s.xml">
268
     <history-entry file="MyArrayListTest_addAtIndexTest - 2018.11.13 at 19h 50m 15s.xml">
271
       <configuration name="MyArrayListTest.addAtIndexTest" configurationId="JUnit" />
269
       <configuration name="MyArrayListTest.addAtIndexTest" configurationId="JUnit" />
272
     </history-entry>
270
     </history-entry>
294
     <history-entry file="MyArrayListTest - 2018.11.14 at 08h 04m 52s.xml">
292
     <history-entry file="MyArrayListTest - 2018.11.14 at 08h 04m 52s.xml">
295
       <configuration name="MyArrayListTest" configurationId="JUnit" />
293
       <configuration name="MyArrayListTest" configurationId="JUnit" />
296
     </history-entry>
294
     </history-entry>
295
+    <history-entry file="MyArrayListTest - 2018.11.14 at 08h 44m 40s.xml">
296
+      <configuration name="MyArrayListTest" configurationId="JUnit" />
297
+    </history-entry>
297
   </component>
298
   </component>
298
   <component name="TimeTrackingManager">
299
   <component name="TimeTrackingManager">
299
-    <option name="totallyTimeSpent" value="10441000" />
300
+    <option name="totallyTimeSpent" value="13060000" />
300
   </component>
301
   </component>
301
   <component name="ToolWindowManager">
302
   <component name="ToolWindowManager">
302
     <frame x="0" y="23" width="1440" height="807" extended-state="0" />
303
     <frame x="0" y="23" width="1440" height="807" extended-state="0" />
338
   <component name="VcsContentAnnotationSettings">
339
   <component name="VcsContentAnnotationSettings">
339
     <option name="myLimit" value="2678400000" />
340
     <option name="myLimit" value="2678400000" />
340
   </component>
341
   </component>
341
-  <component name="XDebuggerManager">
342
-    <breakpoint-manager>
343
-      <breakpoints>
344
-        <line-breakpoint enabled="true" type="java-method">
345
-          <url>file://$PROJECT_DIR$/src/main/java/MyArrayList.java</url>
346
-          <line>26</line>
347
-          <properties class="MyArrayList" method="add">
348
-            <option name="EMULATED" value="true" />
349
-          </properties>
350
-          <option name="timeStamp" value="3" />
351
-        </line-breakpoint>
352
-      </breakpoints>
353
-    </breakpoint-manager>
354
-  </component>
355
   <component name="editorHistoryManager">
342
   <component name="editorHistoryManager">
356
     <entry file="file://$PROJECT_DIR$/.gitignore">
343
     <entry file="file://$PROJECT_DIR$/.gitignore">
357
       <provider selected="true" editor-type-id="text-editor" />
344
       <provider selected="true" editor-type-id="text-editor" />
372
     </entry>
359
     </entry>
373
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
360
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
374
       <provider selected="true" editor-type-id="text-editor">
361
       <provider selected="true" editor-type-id="text-editor">
375
-        <state relative-caret-position="-7">
376
-          <caret line="134" column="23" lean-forward="true" selection-start-line="134" selection-start-column="23" selection-end-line="134" selection-end-column="23" />
362
+        <state relative-caret-position="-2282">
363
+          <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
377
           <folding>
364
           <folding>
378
             <element signature="imports" expanded="true" />
365
             <element signature="imports" expanded="true" />
379
             <element signature="e#143#144#0" expanded="true" />
366
             <element signature="e#143#144#0" expanded="true" />
384
     </entry>
371
     </entry>
385
     <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
372
     <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
386
       <provider selected="true" editor-type-id="text-editor">
373
       <provider selected="true" editor-type-id="text-editor">
387
-        <state relative-caret-position="332">
388
-          <caret line="71" selection-start-line="71" selection-end-line="71" />
374
+        <state relative-caret-position="-722">
375
+          <caret line="3" column="26" selection-start-line="3" selection-start-column="26" selection-end-line="3" selection-end-column="26" />
389
           <folding>
376
           <folding>
390
             <element signature="e#729#730#0" expanded="true" />
377
             <element signature="e#729#730#0" expanded="true" />
391
             <element signature="e#763#764#0" expanded="true" />
378
             <element signature="e#763#764#0" expanded="true" />

+ 9
- 4
src/main/java/MyArrayList.java View File

25
         return true;
25
         return true;
26
     }
26
     }
27
     public void add(T o, int index) {
27
     public void add(T o, int index) {
28
-        list = Arrays.copyOf(list, list.length + 1);
29
-        System.arraycopy(list, index, list, index + 1, size - index);
30
-        list[index] = o;
28
+        Object[] temp = new Object[list.length];
29
+        for (int i = 0; i < index ; i++) {
30
+            temp[i] = list[i];
31
+        }
32
+        temp[index] = o;
33
+        for (int i = index + 1; i < list.length; i++) {
34
+            temp[i] = list[i - 1];
35
+        }
36
+        list = Arrays.copyOf(temp, list.length + 1);
31
     }
37
     }
32
 
38
 
33
     public Object get(int index) {
39
     public Object get(int index) {
69
         return false;
75
         return false;
70
     }
76
     }
71
 
77
 
72
-
73
 }
78
 }

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

1
+public class MySet extends MyArrayList {
2
+}

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

177
         Assert.assertFalse(actual);
177
         Assert.assertFalse(actual);
178
     }
178
     }
179
 
179
 
180
+
180
 }
181
 }

+ 2
- 0
src/test/java/MySetTest.java View File

1
+public class MySetTest {
2
+}