William Brown преди 6 години
родител
ревизия
5abc1f5e51
променени са 3 файла, в които са добавени 73 реда и са изтрити 64 реда
  1. 51
    61
      .idea/workspace.xml
  2. 11
    2
      arraz/src/main/java/Arraz.java
  3. 11
    1
      arraz/src/test/java/ArrazTest.java

+ 51
- 61
.idea/workspace.xml Целия файл

@@ -2,12 +2,6 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_0.xml" beforeDir="false" />
8
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/arraz/arraz.iml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/arraz.iml" afterDir="false" />
10
-      <change beforePath="$PROJECT_DIR$/arraz/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/pom.xml" afterDir="false" />
11 5
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
12 6
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
13 7
     </list>
@@ -21,17 +15,17 @@
21 15
   <component name="CoverageDataManager">
22 16
     <SUITE FILE_PATH="coverage/ArraysGoneWild$ArrazTest_testCheck2ArraysForEqual3.ic" NAME="ArrazTest.testCheck2ArraysForEqual3 Coverage Results" MODIFIED="1544144487539" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
23 17
     <SUITE FILE_PATH="coverage/ArraysGoneWild$ArrazTest_testRemoveElementFromArray3.ic" NAME="ArrazTest.testRemoveElementFromArray3 Coverage Results" MODIFIED="1544144601050" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
24
-    <SUITE FILE_PATH="coverage/ArraysGoneWild$ArrazTest.ic" NAME="ArrazTest Coverage Results" MODIFIED="1544144398898" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
25 18
     <SUITE FILE_PATH="coverage/ArraysGoneWild$ArrazTest_testFindIndexOf2.ic" NAME="ArrazTest.testFindIndexOf2 Coverage Results" MODIFIED="1544144634293" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
19
+    <SUITE FILE_PATH="coverage/ArraysGoneWild$ArrazTest.ic" NAME="ArrazTest Coverage Results" MODIFIED="1544145500960" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
26 20
   </component>
27 21
   <component name="CoverageViewManager">
28
-    <option name="myElementSize" value="154" />
22
+    <option name="myElementSize" value="153" />
29 23
   </component>
30 24
   <component name="FUSProjectUsageTrigger">
31 25
     <session id="-1803996711">
32 26
       <usages-collector id="statistics.lifecycle.project">
33 27
         <counts>
34
-          <entry key="project.closed" value="4" />
28
+          <entry key="project.closed" value="5" />
35 29
           <entry key="project.open.time.14" value="2" />
36 30
           <entry key="project.open.time.2" value="1" />
37 31
           <entry key="project.open.time.4" value="2" />
@@ -40,7 +34,7 @@
40 34
       </usages-collector>
41 35
       <usages-collector id="statistics.file.types.edit">
42 36
         <counts>
43
-          <entry key="JAVA" value="9727" />
37
+          <entry key="JAVA" value="9947" />
44 38
           <entry key="XML" value="4" />
45 39
         </counts>
46 40
       </usages-collector>
@@ -54,19 +48,17 @@
54 48
   </component>
55 49
   <component name="FileEditorManager">
56 50
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
57
-      <file pinned="false" current-in-tab="false">
51
+      <file pinned="false" current-in-tab="true">
58 52
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
59 53
           <provider selected="true" editor-type-id="text-editor">
60
-            <state relative-caret-position="280">
61
-              <caret line="81" column="20" selection-start-line="81" selection-start-column="20" selection-end-line="81" selection-end-column="20" />
54
+            <state relative-caret-position="1335">
55
+              <caret line="89" column="9" lean-forward="true" selection-start-line="89" selection-start-column="9" selection-end-line="89" selection-end-column="9" />
62 56
               <folding>
63 57
                 <element signature="imports" expanded="true" />
64 58
                 <element signature="e#504#505#0" expanded="true" />
65 59
                 <element signature="e#561#562#0" expanded="true" />
66 60
                 <element signature="e#616#617#0" expanded="true" />
67 61
                 <element signature="e#674#675#0" expanded="true" />
68
-                <element signature="e#1783#1784#0" expanded="true" />
69
-                <element signature="e#1810#1811#0" expanded="true" />
70 62
                 <element signature="e#4880#4881#0" expanded="true" />
71 63
                 <element signature="e#4918#4919#0" expanded="true" />
72 64
               </folding>
@@ -74,11 +66,11 @@
74 66
           </provider>
75 67
         </entry>
76 68
       </file>
77
-      <file pinned="false" current-in-tab="true">
69
+      <file pinned="false" current-in-tab="false">
78 70
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
79 71
           <provider selected="true" editor-type-id="text-editor">
80
-            <state relative-caret-position="386">
81
-              <caret line="203" lean-forward="true" selection-start-line="203" selection-end-line="203" />
72
+            <state relative-caret-position="3090">
73
+              <caret line="206" column="37" lean-forward="true" selection-start-line="206" selection-start-column="37" selection-end-line="206" selection-end-column="37" />
82 74
               <folding>
83 75
                 <element signature="imports" expanded="true" />
84 76
                 <element signature="e#8537#8546#0" expanded="true" />
@@ -220,7 +212,7 @@
220 212
     <property name="GO_FMT" value="false" />
221 213
     <property name="WebServerToolWindowFactoryState" value="false" />
222 214
     <property name="aspect.path.notification.shown" value="true" />
223
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544144681387" />
215
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544145500059" />
224 216
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
225 217
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
226 218
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -247,7 +239,7 @@
247 239
       </list>
248 240
     </option>
249 241
   </component>
250
-  <component name="RunManager" selected="JUnit.ArrazTest.testFindIndexOf2">
242
+  <component name="RunManager" selected="JUnit.ArrazTest">
251 243
     <configuration default="true" type="Applet" factoryName="Applet">
252 244
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
253 245
       <method v="2">
@@ -269,44 +261,44 @@
269 261
         <option name="Make" enabled="true" />
270 262
       </method>
271 263
     </configuration>
272
-    <configuration name="ArrazTest.testCheck2ArraysForEqual3" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
264
+    <configuration name="ArrazTest.testCopyArrayByInterator1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
273 265
       <module name="arraz" />
274 266
       <option name="PACKAGE_NAME" value="" />
275 267
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
276
-      <option name="METHOD_NAME" value="testCheck2ArraysForEqual3" />
268
+      <option name="METHOD_NAME" value="testCopyArrayByInterator1" />
277 269
       <option name="TEST_OBJECT" value="method" />
278 270
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
279 271
       <method v="2">
280 272
         <option name="Make" enabled="true" />
281 273
       </method>
282 274
     </configuration>
283
-    <configuration name="ArrazTest.testFindIndexOf2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
275
+    <configuration name="ArrazTest.testCopyArrayByInterator2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
284 276
       <module name="arraz" />
285 277
       <option name="PACKAGE_NAME" value="" />
286 278
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
287
-      <option name="METHOD_NAME" value="testFindIndexOf2" />
279
+      <option name="METHOD_NAME" value="testCopyArrayByInterator2" />
288 280
       <option name="TEST_OBJECT" value="method" />
289 281
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
290 282
       <method v="2">
291 283
         <option name="Make" enabled="true" />
292 284
       </method>
293 285
     </configuration>
294
-    <configuration name="ArrazTest.testRemoveElementFromArray3" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
286
+    <configuration name="ArrazTest.testFindIndexOf2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
295 287
       <module name="arraz" />
296 288
       <option name="PACKAGE_NAME" value="" />
297 289
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
298
-      <option name="METHOD_NAME" value="testRemoveElementFromArray3" />
290
+      <option name="METHOD_NAME" value="testFindIndexOf2" />
299 291
       <option name="TEST_OBJECT" value="method" />
300 292
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
301 293
       <method v="2">
302 294
         <option name="Make" enabled="true" />
303 295
       </method>
304 296
     </configuration>
305
-    <configuration name="ArrazTest.testSumValuesOfArrayPostive" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
297
+    <configuration name="ArrazTest.testRemoveElementFromArray3" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
306 298
       <module name="arraz" />
307 299
       <option name="PACKAGE_NAME" value="" />
308 300
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
309
-      <option name="METHOD_NAME" value="testSumValuesOfArrayPostive" />
301
+      <option name="METHOD_NAME" value="testRemoveElementFromArray3" />
310 302
       <option name="TEST_OBJECT" value="method" />
311 303
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
312 304
       <method v="2">
@@ -337,19 +329,19 @@
337 329
       </method>
338 330
     </configuration>
339 331
     <list>
340
-      <item itemvalue="JUnit.ArrazTest" />
341
-      <item itemvalue="JUnit.ArrazTest.testSumValuesOfArrayPostive" />
342
-      <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual3" />
343 332
       <item itemvalue="JUnit.ArrazTest.testRemoveElementFromArray3" />
344 333
       <item itemvalue="JUnit.ArrazTest.testFindIndexOf2" />
334
+      <item itemvalue="JUnit.ArrazTest.testCopyArrayByInterator1" />
335
+      <item itemvalue="JUnit.ArrazTest.testCopyArrayByInterator2" />
336
+      <item itemvalue="JUnit.ArrazTest" />
345 337
     </list>
346 338
     <recent_temporary>
347 339
       <list>
340
+        <item itemvalue="JUnit.ArrazTest" />
341
+        <item itemvalue="JUnit.ArrazTest.testCopyArrayByInterator2" />
342
+        <item itemvalue="JUnit.ArrazTest.testCopyArrayByInterator1" />
348 343
         <item itemvalue="JUnit.ArrazTest.testFindIndexOf2" />
349 344
         <item itemvalue="JUnit.ArrazTest.testRemoveElementFromArray3" />
350
-        <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual3" />
351
-        <item itemvalue="JUnit.ArrazTest" />
352
-        <item itemvalue="JUnit.ArrazTest.testSumValuesOfArrayPostive" />
353 345
       </list>
354 346
     </recent_temporary>
355 347
   </component>
@@ -370,7 +362,7 @@
370 362
       <workItem from="1544045942928" duration="2151000" />
371 363
       <workItem from="1544048104554" duration="1398000" />
372 364
       <workItem from="1544060926907" duration="4177000" />
373
-      <workItem from="1544125434968" duration="10376000" />
365
+      <workItem from="1544125434968" duration="11066000" />
374 366
     </task>
375 367
     <task id="LOCAL-00001" summary="readme and docs">
376 368
       <created>1544021313039</created>
@@ -383,15 +375,6 @@
383 375
     <servers />
384 376
   </component>
385 377
   <component name="TestHistory">
386
-    <history-entry file="ArrazTest_testSortArrayIntoEvensThenOdds2 - 2018.12.06 at 19h 44m 17s.xml">
387
-      <configuration name="ArrazTest.testSortArrayIntoEvensThenOdds2" configurationId="JUnit" />
388
-    </history-entry>
389
-    <history-entry file="ArrazTest - 2018.12.06 at 19h 44m 27s.xml">
390
-      <configuration name="ArrazTest" configurationId="JUnit" />
391
-    </history-entry>
392
-    <history-entry file="ArrazTest_testSumValuesOfArrayPostive - 2018.12.06 at 19h 45m 11s.xml">
393
-      <configuration name="ArrazTest.testSumValuesOfArrayPostive" configurationId="JUnit" />
394
-    </history-entry>
395 378
     <history-entry file="ArrazTest - 2018.12.06 at 19h 59m 51s.xml">
396 379
       <configuration name="ArrazTest" configurationId="JUnit" />
397 380
     </history-entry>
@@ -413,9 +396,18 @@
413 396
     <history-entry file="ArrazTest_testFindIndexOf2 - 2018.12.06 at 20h 03m 57s.xml">
414 397
       <configuration name="ArrazTest.testFindIndexOf2" configurationId="JUnit" />
415 398
     </history-entry>
399
+    <history-entry file="ArrazTest_testCopyArrayByInterator1 - 2018.12.06 at 20h 18m 09s.xml">
400
+      <configuration name="ArrazTest.testCopyArrayByInterator1" configurationId="JUnit" />
401
+    </history-entry>
402
+    <history-entry file="ArrazTest_testCopyArrayByInterator2 - 2018.12.06 at 20h 18m 15s.xml">
403
+      <configuration name="ArrazTest.testCopyArrayByInterator2" configurationId="JUnit" />
404
+    </history-entry>
405
+    <history-entry file="ArrazTest - 2018.12.06 at 20h 18m 25s.xml">
406
+      <configuration name="ArrazTest" configurationId="JUnit" />
407
+    </history-entry>
416 408
   </component>
417 409
   <component name="TimeTrackingManager">
418
-    <option name="totallyTimeSpent" value="21524000" />
410
+    <option name="totallyTimeSpent" value="22214000" />
419 411
   </component>
420 412
   <component name="ToolWindowManager">
421 413
     <frame x="0" y="22" width="1280" height="739" extended-state="0" />
@@ -480,32 +472,30 @@
480 472
         </state>
481 473
       </provider>
482 474
     </entry>
483
-    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
475
+    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
484 476
       <provider selected="true" editor-type-id="text-editor">
485
-        <state relative-caret-position="280">
486
-          <caret line="81" column="20" selection-start-line="81" selection-start-column="20" selection-end-line="81" selection-end-column="20" />
477
+        <state relative-caret-position="3090">
478
+          <caret line="206" column="37" lean-forward="true" selection-start-line="206" selection-start-column="37" selection-end-line="206" selection-end-column="37" />
487 479
           <folding>
488 480
             <element signature="imports" expanded="true" />
489
-            <element signature="e#504#505#0" expanded="true" />
490
-            <element signature="e#561#562#0" expanded="true" />
491
-            <element signature="e#616#617#0" expanded="true" />
492
-            <element signature="e#674#675#0" expanded="true" />
493
-            <element signature="e#1783#1784#0" expanded="true" />
494
-            <element signature="e#1810#1811#0" expanded="true" />
495
-            <element signature="e#4880#4881#0" expanded="true" />
496
-            <element signature="e#4918#4919#0" expanded="true" />
481
+            <element signature="e#8537#8546#0" expanded="true" />
482
+            <element signature="e#8823#8832#0" expanded="true" />
497 483
           </folding>
498 484
         </state>
499 485
       </provider>
500 486
     </entry>
501
-    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
487
+    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
502 488
       <provider selected="true" editor-type-id="text-editor">
503
-        <state relative-caret-position="386">
504
-          <caret line="203" lean-forward="true" selection-start-line="203" selection-end-line="203" />
489
+        <state relative-caret-position="1335">
490
+          <caret line="89" column="9" lean-forward="true" selection-start-line="89" selection-start-column="9" selection-end-line="89" selection-end-column="9" />
505 491
           <folding>
506 492
             <element signature="imports" expanded="true" />
507
-            <element signature="e#8537#8546#0" expanded="true" />
508
-            <element signature="e#8823#8832#0" expanded="true" />
493
+            <element signature="e#504#505#0" expanded="true" />
494
+            <element signature="e#561#562#0" expanded="true" />
495
+            <element signature="e#616#617#0" expanded="true" />
496
+            <element signature="e#674#675#0" expanded="true" />
497
+            <element signature="e#4880#4881#0" expanded="true" />
498
+            <element signature="e#4918#4919#0" expanded="true" />
509 499
           </folding>
510 500
         </state>
511 501
       </provider>

+ 11
- 2
arraz/src/main/java/Arraz.java Целия файл

@@ -1,4 +1,6 @@
1 1
 import java.util.ArrayList;
2
+import java.util.Arrays;
3
+import java.util.Iterator;
2 4
 import java.util.List;
3 5
 
4 6
 public class Arraz {
@@ -78,8 +80,15 @@ public class Arraz {
78 80
         return output;
79 81
     }
80 82
 
81
-    public int[] copyArrayByInterator(){
82
-        return null;
83
+    public Integer[] copyArrayByInterator(Integer[] arr){
84
+        Integer[] output = new Integer[arr.length];
85
+        int count = 0;
86
+        Iterator iterator = Arrays.asList(arr).iterator();
87
+        while(iterator.hasNext()){
88
+            output[count] = Integer.parseInt(iterator.next().toString());
89
+            count++;
90
+        }
91
+        return output;
83 92
     }
84 93
 
85 94
     public int[] removeElementFromArray(int[] arr, int n) {

+ 11
- 1
arraz/src/test/java/ArrazTest.java Целия файл

@@ -193,18 +193,28 @@ public class ArrazTest {
193 193
 
194 194
         int[] actual = arraz.copyArrayByLoop(arr);
195 195
 
196
-        Assert.assertEquals(arr, actual);
196
+        Assert.assertArrayEquals(arr, actual);
197 197
         Assert.assertNotNull(actual);
198 198
     }
199 199
 
200 200
     @Test
201 201
     public void testCopyArrayByInterator1(){
202
+        Integer[] arr = new Integer[] {1,2,3,4,5,6,7,8};
203
+
204
+        Integer[] actual = arraz.copyArrayByInterator(arr);
202 205
 
206
+        Assert.assertArrayEquals(arr, actual);
207
+        Assert.assertNotNull(actual);
203 208
     }
204 209
 
205 210
     @Test
206 211
     public void testCopyArrayByInterator2(){
212
+        Integer[] arr = new Integer[] {1,2,3,4,5,6,7,8};
207 213
 
214
+        Integer[] actual = arraz.copyArrayByInterator(arr);
215
+
216
+        Assert.assertArrayEquals(arr, actual);
217
+        Assert.assertNotNull(actual);
208 218
     }
209 219
 
210 220
     @Test