Seth преди 6 години
родител
ревизия
43a08eba20
променени са 5 файла, в които са добавени 32 реда и са изтрити 35 реда
  1. 18
    31
      .idea/workspace.xml
  2. 9
    4
      src/main/java/MyArrayList.java
  3. 2
    0
      src/main/java/MySet.java
  4. 1
    0
      src/test/java/MyArrayListTest.java
  5. 2
    0
      src/test/java/MySetTest.java

+ 18
- 31
.idea/workspace.xml Целия файл

@@ -2,6 +2,7 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 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 6
       <change beforePath="$PROJECT_DIR$/src/main/java/MyArrayList.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/MyArrayList.java" afterDir="false" />
6 7
       <change beforePath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" afterDir="false" />
7 8
     </list>
@@ -36,12 +37,12 @@
36 37
       </usages-collector>
37 38
       <usages-collector id="statistics.file.extensions.edit">
38 39
         <counts>
39
-          <entry key="java" value="3332" />
40
+          <entry key="java" value="3540" />
40 41
         </counts>
41 42
       </usages-collector>
42 43
       <usages-collector id="statistics.file.types.edit">
43 44
         <counts>
44
-          <entry key="JAVA" value="3332" />
45
+          <entry key="JAVA" value="3540" />
45 46
         </counts>
46 47
       </usages-collector>
47 48
     </session>
@@ -51,8 +52,8 @@
51 52
       <file pinned="false" current-in-tab="false">
52 53
         <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
53 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 57
               <folding>
57 58
                 <element signature="imports" expanded="true" />
58 59
                 <element signature="e#143#144#0" expanded="true" />
@@ -65,8 +66,8 @@
65 66
       <file pinned="false" current-in-tab="true">
66 67
         <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
67 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 71
               <folding>
71 72
                 <element signature="e#729#730#0" expanded="true" />
72 73
                 <element signature="e#763#764#0" expanded="true" />
@@ -94,8 +95,8 @@
94 95
   <component name="IdeDocumentHistory">
95 96
     <option name="CHANGED_PATHS">
96 97
       <list>
97
-        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
98 98
         <option value="$PROJECT_DIR$/src/main/java/MyArrayList.java" />
99
+        <option value="$PROJECT_DIR$/src/test/java/MyArrayListTest.java" />
99 100
       </list>
100 101
     </option>
101 102
   </component>
@@ -165,7 +166,7 @@
165 166
   <component name="PropertiesComponent">
166 167
     <property name="WebServerToolWindowFactoryState" value="false" />
167 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 170
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
170 171
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
171 172
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -259,14 +260,11 @@
259 260
       <option name="number" value="Default" />
260 261
       <option name="presentableId" value="Default" />
261 262
       <updated>1542149227412</updated>
262
-      <workItem from="1542149228819" duration="10441000" />
263
+      <workItem from="1542149228819" duration="13060000" />
263 264
     </task>
264 265
     <servers />
265 266
   </component>
266 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 268
     <history-entry file="MyArrayListTest_addAtIndexTest - 2018.11.13 at 19h 50m 15s.xml">
271 269
       <configuration name="MyArrayListTest.addAtIndexTest" configurationId="JUnit" />
272 270
     </history-entry>
@@ -294,9 +292,12 @@
294 292
     <history-entry file="MyArrayListTest - 2018.11.14 at 08h 04m 52s.xml">
295 293
       <configuration name="MyArrayListTest" configurationId="JUnit" />
296 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 298
   </component>
298 299
   <component name="TimeTrackingManager">
299
-    <option name="totallyTimeSpent" value="10441000" />
300
+    <option name="totallyTimeSpent" value="13060000" />
300 301
   </component>
301 302
   <component name="ToolWindowManager">
302 303
     <frame x="0" y="23" width="1440" height="807" extended-state="0" />
@@ -338,20 +339,6 @@
338 339
   <component name="VcsContentAnnotationSettings">
339 340
     <option name="myLimit" value="2678400000" />
340 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 342
   <component name="editorHistoryManager">
356 343
     <entry file="file://$PROJECT_DIR$/.gitignore">
357 344
       <provider selected="true" editor-type-id="text-editor" />
@@ -372,8 +359,8 @@
372 359
     </entry>
373 360
     <entry file="file://$PROJECT_DIR$/src/test/java/MyArrayListTest.java">
374 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 364
           <folding>
378 365
             <element signature="imports" expanded="true" />
379 366
             <element signature="e#143#144#0" expanded="true" />
@@ -384,8 +371,8 @@
384 371
     </entry>
385 372
     <entry file="file://$PROJECT_DIR$/src/main/java/MyArrayList.java">
386 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 376
           <folding>
390 377
             <element signature="e#729#730#0" expanded="true" />
391 378
             <element signature="e#763#764#0" expanded="true" />

+ 9
- 4
src/main/java/MyArrayList.java Целия файл

@@ -25,9 +25,15 @@ public class MyArrayList<T> {
25 25
         return true;
26 26
     }
27 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 39
     public Object get(int index) {
@@ -69,5 +75,4 @@ public class MyArrayList<T> {
69 75
         return false;
70 76
     }
71 77
 
72
-
73 78
 }

+ 2
- 0
src/main/java/MySet.java Целия файл

@@ -0,0 +1,2 @@
1
+public class MySet extends MyArrayList {
2
+}

+ 1
- 0
src/test/java/MyArrayListTest.java Целия файл

@@ -177,4 +177,5 @@ public class MyArrayListTest {
177 177
         Assert.assertFalse(actual);
178 178
     }
179 179
 
180
+
180 181
 }

+ 2
- 0
src/test/java/MySetTest.java Целия файл

@@ -0,0 +1,2 @@
1
+public class MySetTest {
2
+}