2 Commits

Auteur SHA1 Bericht Datum
  Seth 829f794f7d insersts 6 jaren geleden
  Seth 33d8195416 10s30 6 jaren geleden
3 gewijzigde bestanden met toevoegingen van 270 en 81 verwijderingen
  1. 111
    72
      .idea/workspace.xml
  2. 45
    4
      arraz/src/main/java/Arraz.java
  3. 114
    5
      arraz/src/test/java/ArrazTest.java

+ 111
- 72
.idea/workspace.xml Bestand weergeven

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
5
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
7
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
8
     </list>
7
     </list>
23
       </usages-collector>
22
       </usages-collector>
24
       <usages-collector id="statistics.file.types.edit">
23
       <usages-collector id="statistics.file.types.edit">
25
         <counts>
24
         <counts>
26
-          <entry key="JAVA" value="11042" />
25
+          <entry key="JAVA" value="14150" />
27
           <entry key="XML" value="3" />
26
           <entry key="XML" value="3" />
28
         </counts>
27
         </counts>
29
       </usages-collector>
28
       </usages-collector>
30
       <usages-collector id="statistics.file.types.open">
29
       <usages-collector id="statistics.file.types.open">
31
         <counts>
30
         <counts>
32
           <entry key="CLASS" value="1" />
31
           <entry key="CLASS" value="1" />
33
-          <entry key="JAVA" value="5" />
32
+          <entry key="JAVA" value="6" />
34
           <entry key="XML" value="3" />
33
           <entry key="XML" value="3" />
35
         </counts>
34
         </counts>
36
       </usages-collector>
35
       </usages-collector>
39
   <component name="FileEditorManager">
38
   <component name="FileEditorManager">
40
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
39
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
41
       <file pinned="false" current-in-tab="false">
40
       <file pinned="false" current-in-tab="false">
42
-        <entry file="file://$PROJECT_DIR$/README.md">
43
-          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
44
-            <state split_layout="SPLIT">
45
-              <first_editor relative-caret-position="306">
46
-                <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
47
-              </first_editor>
48
-              <second_editor />
49
-            </state>
50
-          </provider>
51
-        </entry>
52
-      </file>
53
-      <file pinned="false" current-in-tab="true">
54
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
41
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
55
           <provider selected="true" editor-type-id="text-editor">
42
           <provider selected="true" editor-type-id="text-editor">
56
-            <state relative-caret-position="285">
57
-              <caret line="130" column="19" selection-start-line="130" selection-start-column="19" selection-end-line="130" selection-end-column="19" />
43
+            <state relative-caret-position="300">
44
+              <caret line="198" column="41" selection-start-line="198" selection-start-column="41" selection-end-line="198" selection-end-column="41" />
58
               <folding>
45
               <folding>
59
                 <element signature="e#3440#3441#0" expanded="true" />
46
                 <element signature="e#3440#3441#0" expanded="true" />
60
                 <element signature="e#3482#3483#0" expanded="true" />
47
                 <element signature="e#3482#3483#0" expanded="true" />
62
                 <element signature="e#3603#3604#0" expanded="true" />
49
                 <element signature="e#3603#3604#0" expanded="true" />
63
                 <element signature="e#3677#3678#0" expanded="true" />
50
                 <element signature="e#3677#3678#0" expanded="true" />
64
                 <element signature="e#3714#3715#0" expanded="true" />
51
                 <element signature="e#3714#3715#0" expanded="true" />
52
+                <element signature="e#4954#4955#0" expanded="true" />
53
+                <element signature="e#4995#4996#0" expanded="true" />
54
+                <element signature="e#5042#5043#0" expanded="true" />
55
+                <element signature="e#5115#5116#0" expanded="true" />
56
+                <element signature="e#5173#5174#0" expanded="true" />
57
+                <element signature="e#5234#5235#0" expanded="true" />
58
+                <element signature="e#5305#5306#0" expanded="true" />
59
+                <element signature="e#5342#5343#0" expanded="true" />
65
               </folding>
60
               </folding>
66
             </state>
61
             </state>
67
           </provider>
62
           </provider>
68
         </entry>
63
         </entry>
69
       </file>
64
       </file>
70
-      <file pinned="false" current-in-tab="false">
65
+      <file pinned="false" current-in-tab="true">
71
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
66
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
72
           <provider selected="true" editor-type-id="text-editor">
67
           <provider selected="true" editor-type-id="text-editor">
73
-            <state relative-caret-position="253">
74
-              <caret line="256" column="72" selection-start-line="256" selection-start-column="72" selection-end-line="256" selection-end-column="72" />
68
+            <state relative-caret-position="300">
69
+              <caret line="462" column="5" lean-forward="true" selection-start-line="462" selection-start-column="5" selection-end-line="462" selection-end-column="5" />
75
               <folding>
70
               <folding>
76
                 <element signature="imports" expanded="true" />
71
                 <element signature="imports" expanded="true" />
77
               </folding>
72
               </folding>
80
         </entry>
75
         </entry>
81
       </file>
76
       </file>
82
       <file pinned="false" current-in-tab="false">
77
       <file pinned="false" current-in-tab="false">
78
+        <entry file="file://$PROJECT_DIR$/README.md">
79
+          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
80
+            <state split_layout="SPLIT">
81
+              <first_editor relative-caret-position="306">
82
+                <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
83
+              </first_editor>
84
+              <second_editor />
85
+            </state>
86
+          </provider>
87
+        </entry>
88
+      </file>
89
+      <file pinned="false" current-in-tab="false">
83
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
90
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
84
           <provider selected="true" editor-type-id="text-editor">
91
           <provider selected="true" editor-type-id="text-editor">
85
             <state>
92
             <state>
106
   </component>
113
   </component>
107
   <component name="FindInProjectRecents">
114
   <component name="FindInProjectRecents">
108
     <findStrings>
115
     <findStrings>
116
+      <find>list</find>
117
+      <find>rev</find>
109
       <find>sort</find>
118
       <find>sort</find>
119
+      <find>rever</find>
110
     </findStrings>
120
     </findStrings>
111
   </component>
121
   </component>
112
   <component name="Git.Settings">
122
   <component name="Git.Settings">
220
     <property name="GO_FMT" value="false" />
230
     <property name="GO_FMT" value="false" />
221
     <property name="WebServerToolWindowFactoryState" value="false" />
231
     <property name="WebServerToolWindowFactoryState" value="false" />
222
     <property name="aspect.path.notification.shown" value="true" />
232
     <property name="aspect.path.notification.shown" value="true" />
223
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544205690510" />
233
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544219473137" />
224
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
234
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
225
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
235
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
226
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
236
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
250
       </list>
260
       </list>
251
     </option>
261
     </option>
252
   </component>
262
   </component>
253
-  <component name="RunManager" selected="JUnit.ArrazTest.testFind2ndLargestFromArray1">
263
+  <component name="RunManager" selected="JUnit.ArrazTest.testInsertEndCopy1">
254
     <configuration default="true" type="Applet" factoryName="Applet">
264
     <configuration default="true" type="Applet" factoryName="Applet">
255
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
265
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
256
       <method v="2">
266
       <method v="2">
272
         <option name="Make" enabled="true" />
282
         <option name="Make" enabled="true" />
273
       </method>
283
       </method>
274
     </configuration>
284
     </configuration>
275
-    <configuration name="ArrazTest.testArrayHas65and771" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
285
+    <configuration name="ArrazTest.testInsertEndCopy1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
276
       <module name="arraz" />
286
       <module name="arraz" />
277
       <option name="PACKAGE_NAME" value="" />
287
       <option name="PACKAGE_NAME" value="" />
278
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
288
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
279
-      <option name="METHOD_NAME" value="testArrayHas65and771" />
289
+      <option name="METHOD_NAME" value="testInsertEndCopy1" />
280
       <option name="TEST_OBJECT" value="method" />
290
       <option name="TEST_OBJECT" value="method" />
281
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
291
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
282
       <method v="2">
292
       <method v="2">
283
         <option name="Make" enabled="true" />
293
         <option name="Make" enabled="true" />
284
       </method>
294
       </method>
285
     </configuration>
295
     </configuration>
286
-    <configuration name="ArrazTest.testArrayHas65and772" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
296
+    <configuration name="ArrazTest.testInsertEndCopy2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
287
       <module name="arraz" />
297
       <module name="arraz" />
288
       <option name="PACKAGE_NAME" value="" />
298
       <option name="PACKAGE_NAME" value="" />
289
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
299
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
290
-      <option name="METHOD_NAME" value="testArrayHas65and772" />
300
+      <option name="METHOD_NAME" value="testInsertEndCopy2" />
291
       <option name="TEST_OBJECT" value="method" />
301
       <option name="TEST_OBJECT" value="method" />
292
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
302
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
293
       <method v="2">
303
       <method v="2">
294
         <option name="Make" enabled="true" />
304
         <option name="Make" enabled="true" />
295
       </method>
305
       </method>
296
     </configuration>
306
     </configuration>
297
-    <configuration name="ArrazTest.testFind2ndLargestFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
307
+    <configuration name="ArrazTest.testInsertStartCopy1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
298
       <module name="arraz" />
308
       <module name="arraz" />
299
       <option name="PACKAGE_NAME" value="" />
309
       <option name="PACKAGE_NAME" value="" />
300
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
310
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
301
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray1" />
311
+      <option name="METHOD_NAME" value="testInsertStartCopy1" />
302
       <option name="TEST_OBJECT" value="method" />
312
       <option name="TEST_OBJECT" value="method" />
303
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
313
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
304
       <method v="2">
314
       <method v="2">
305
         <option name="Make" enabled="true" />
315
         <option name="Make" enabled="true" />
306
       </method>
316
       </method>
307
     </configuration>
317
     </configuration>
308
-    <configuration name="ArrazTest.testFind2ndLargestFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
318
+    <configuration name="ArrazTest.testInsertStartCopy2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309
       <module name="arraz" />
319
       <module name="arraz" />
310
       <option name="PACKAGE_NAME" value="" />
320
       <option name="PACKAGE_NAME" value="" />
311
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
321
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
312
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray2" />
322
+      <option name="METHOD_NAME" value="testInsertStartCopy2" />
313
       <option name="TEST_OBJECT" value="method" />
323
       <option name="TEST_OBJECT" value="method" />
314
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
324
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
315
       <method v="2">
325
       <method v="2">
341
     </configuration>
351
     </configuration>
342
     <list>
352
     <list>
343
       <item itemvalue="JUnit.ArrazTest" />
353
       <item itemvalue="JUnit.ArrazTest" />
344
-      <item itemvalue="JUnit.ArrazTest.testArrayHas65and771" />
345
-      <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
346
-      <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
347
-      <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
354
+      <item itemvalue="JUnit.ArrazTest.testInsertStartCopy1" />
355
+      <item itemvalue="JUnit.ArrazTest.testInsertStartCopy2" />
356
+      <item itemvalue="JUnit.ArrazTest.testInsertEndCopy2" />
357
+      <item itemvalue="JUnit.ArrazTest.testInsertEndCopy1" />
348
     </list>
358
     </list>
349
     <recent_temporary>
359
     <recent_temporary>
350
       <list>
360
       <list>
351
-        <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
352
-        <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
353
-        <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
354
-        <item itemvalue="JUnit.ArrazTest.testArrayHas65and771" />
361
+        <item itemvalue="JUnit.ArrazTest.testInsertEndCopy1" />
362
+        <item itemvalue="JUnit.ArrazTest.testInsertEndCopy2" />
363
+        <item itemvalue="JUnit.ArrazTest.testInsertStartCopy2" />
364
+        <item itemvalue="JUnit.ArrazTest.testInsertStartCopy1" />
355
         <item itemvalue="JUnit.ArrazTest" />
365
         <item itemvalue="JUnit.ArrazTest" />
356
       </list>
366
       </list>
357
     </recent_temporary>
367
     </recent_temporary>
369
       <workItem from="1543955862749" duration="2347000" />
379
       <workItem from="1543955862749" duration="2347000" />
370
       <workItem from="1543958998826" duration="113000" />
380
       <workItem from="1543958998826" duration="113000" />
371
       <workItem from="1544020724645" duration="762000" />
381
       <workItem from="1544020724645" duration="762000" />
372
-      <workItem from="1544046933389" duration="34996000" />
382
+      <workItem from="1544046933389" duration="44493000" />
373
     </task>
383
     </task>
374
     <task id="LOCAL-00001" summary="readme and docs">
384
     <task id="LOCAL-00001" summary="readme and docs">
375
       <created>1544021313039</created>
385
       <created>1544021313039</created>
382
     <servers />
392
     <servers />
383
   </component>
393
   </component>
384
   <component name="TestHistory">
394
   <component name="TestHistory">
385
-    <history-entry file="ArrazTest_testArrayHas65and771 - 2018.12.07 at 10h 54m 19s.xml">
386
-      <configuration name="ArrazTest.testArrayHas65and771" configurationId="JUnit" />
395
+    <history-entry file="ArrazTest_testInsertArrayAt2 - 2018.12.07 at 16h 02m 54s.xml">
396
+      <configuration name="ArrazTest.testInsertArrayAt2" configurationId="JUnit" />
387
     </history-entry>
397
     </history-entry>
388
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 10h 54m 23s.xml">
389
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
398
+    <history-entry file="ArrazTest_testInsertArrayAt2 - 2018.12.07 at 16h 03m 30s.xml">
399
+      <configuration name="ArrazTest.testInsertArrayAt2" configurationId="JUnit" />
390
     </history-entry>
400
     </history-entry>
391
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin2 - 2018.12.07 at 12h 43m 07s.xml">
392
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin2" configurationId="JUnit" />
401
+    <history-entry file="ArrazTest_testInsertArrayAt1 - 2018.12.07 at 16h 03m 55s.xml">
402
+      <configuration name="ArrazTest.testInsertArrayAt1" configurationId="JUnit" />
393
     </history-entry>
403
     </history-entry>
394
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin - 2018.12.07 at 12h 43m 51s.xml">
395
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin" configurationId="JUnit" />
404
+    <history-entry file="ArrazTest - 2018.12.07 at 16h 05m 27s.xml">
405
+      <configuration name="ArrazTest" configurationId="JUnit" />
396
     </history-entry>
406
     </history-entry>
397
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin - 2018.12.07 at 12h 44m 05s.xml">
398
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin" configurationId="JUnit" />
407
+    <history-entry file="ArrazTest_testInsertStartCopy1 - 2018.12.07 at 16h 31m 44s.xml">
408
+      <configuration name="ArrazTest.testInsertStartCopy1" configurationId="JUnit" />
399
     </history-entry>
409
     </history-entry>
400
-    <history-entry file="ArrazTest_test1SumValuesOfArray1 - 2018.12.07 at 12h 46m 13s.xml">
401
-      <configuration name="ArrazTest.test1SumValuesOfArray1" configurationId="JUnit" />
410
+    <history-entry file="ArrazTest_testInsertStartCopy2 - 2018.12.07 at 16h 31m 46s.xml">
411
+      <configuration name="ArrazTest.testInsertStartCopy2" configurationId="JUnit" />
402
     </history-entry>
412
     </history-entry>
403
-    <history-entry file="ArrazTest - 2018.12.07 at 12h 46m 18s.xml">
404
-      <configuration name="ArrazTest" configurationId="JUnit" />
413
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 45m 50s.xml">
414
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
405
     </history-entry>
415
     </history-entry>
406
-    <history-entry file="ArrazTest_testArrayHas65and771 - 2018.12.07 at 12h 51m 30s.xml">
407
-      <configuration name="ArrazTest.testArrayHas65and771" configurationId="JUnit" />
416
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 46m 24s.xml">
417
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
408
     </history-entry>
418
     </history-entry>
409
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 12h 51m 33s.xml">
410
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
419
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 46m 57s.xml">
420
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
411
     </history-entry>
421
     </history-entry>
412
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 12h 52m 03s.xml">
413
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
422
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 47m 14s.xml">
423
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
414
     </history-entry>
424
     </history-entry>
415
   </component>
425
   </component>
416
   <component name="TimeTrackingManager">
426
   <component name="TimeTrackingManager">
417
-    <option name="totallyTimeSpent" value="38218000" />
427
+    <option name="totallyTimeSpent" value="47715000" />
418
   </component>
428
   </component>
419
   <component name="ToolWindowManager">
429
   <component name="ToolWindowManager">
420
     <frame x="1" y="23" width="1440" height="807" extended-state="0" />
430
     <frame x="1" y="23" width="1440" height="807" extended-state="0" />
490
     <MESSAGE value="readme and docs" />
500
     <MESSAGE value="readme and docs" />
491
     <option name="LAST_COMMIT_MESSAGE" value="readme and docs" />
501
     <option name="LAST_COMMIT_MESSAGE" value="readme and docs" />
492
   </component>
502
   </component>
503
+  <component name="XDebuggerManager">
504
+    <breakpoint-manager>
505
+      <breakpoints>
506
+        <line-breakpoint enabled="true" type="java-method">
507
+          <url>file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java</url>
508
+          <line>206</line>
509
+          <properties class="ArrazTest" method="testInsertArrayAt2">
510
+            <option name="EMULATED" value="true" />
511
+          </properties>
512
+          <option name="timeStamp" value="26" />
513
+        </line-breakpoint>
514
+      </breakpoints>
515
+    </breakpoint-manager>
516
+  </component>
493
   <component name="editorHistoryManager">
517
   <component name="editorHistoryManager">
494
     <entry file="file://$PROJECT_DIR$/arraz/pom.xml">
518
     <entry file="file://$PROJECT_DIR$/arraz/pom.xml">
495
       <provider selected="true" editor-type-id="text-editor">
519
       <provider selected="true" editor-type-id="text-editor">
529
         </state>
553
         </state>
530
       </provider>
554
       </provider>
531
     </entry>
555
     </entry>
556
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
557
+      <provider selected="true" editor-type-id="text-editor">
558
+        <state relative-caret-position="-10766">
559
+          <caret line="106" column="13" selection-start-line="106" selection-start-column="13" selection-end-line="106" selection-end-column="13" />
560
+        </state>
561
+      </provider>
562
+    </entry>
532
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
563
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
533
       <provider selected="true" editor-type-id="text-editor">
564
       <provider selected="true" editor-type-id="text-editor">
534
         <state>
565
         <state>
552
         </state>
583
         </state>
553
       </provider>
584
       </provider>
554
     </entry>
585
     </entry>
555
-    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
556
-      <provider selected="true" editor-type-id="text-editor">
557
-        <state relative-caret-position="253">
558
-          <caret line="256" column="72" selection-start-line="256" selection-start-column="72" selection-end-line="256" selection-end-column="72" />
559
-          <folding>
560
-            <element signature="imports" expanded="true" />
561
-          </folding>
562
-        </state>
563
-      </provider>
564
-    </entry>
565
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
586
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
566
       <provider selected="true" editor-type-id="text-editor">
587
       <provider selected="true" editor-type-id="text-editor">
567
-        <state relative-caret-position="285">
568
-          <caret line="130" column="19" selection-start-line="130" selection-start-column="19" selection-end-line="130" selection-end-column="19" />
588
+        <state relative-caret-position="300">
589
+          <caret line="198" column="41" selection-start-line="198" selection-start-column="41" selection-end-line="198" selection-end-column="41" />
569
           <folding>
590
           <folding>
570
             <element signature="e#3440#3441#0" expanded="true" />
591
             <element signature="e#3440#3441#0" expanded="true" />
571
             <element signature="e#3482#3483#0" expanded="true" />
592
             <element signature="e#3482#3483#0" expanded="true" />
573
             <element signature="e#3603#3604#0" expanded="true" />
594
             <element signature="e#3603#3604#0" expanded="true" />
574
             <element signature="e#3677#3678#0" expanded="true" />
595
             <element signature="e#3677#3678#0" expanded="true" />
575
             <element signature="e#3714#3715#0" expanded="true" />
596
             <element signature="e#3714#3715#0" expanded="true" />
597
+            <element signature="e#4954#4955#0" expanded="true" />
598
+            <element signature="e#4995#4996#0" expanded="true" />
599
+            <element signature="e#5042#5043#0" expanded="true" />
600
+            <element signature="e#5115#5116#0" expanded="true" />
601
+            <element signature="e#5173#5174#0" expanded="true" />
602
+            <element signature="e#5234#5235#0" expanded="true" />
603
+            <element signature="e#5305#5306#0" expanded="true" />
604
+            <element signature="e#5342#5343#0" expanded="true" />
605
+          </folding>
606
+        </state>
607
+      </provider>
608
+    </entry>
609
+    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
610
+      <provider selected="true" editor-type-id="text-editor">
611
+        <state relative-caret-position="300">
612
+          <caret line="462" column="5" lean-forward="true" selection-start-line="462" selection-start-column="5" selection-end-line="462" selection-end-column="5" />
613
+          <folding>
614
+            <element signature="imports" expanded="true" />
576
           </folding>
615
           </folding>
577
         </state>
616
         </state>
578
       </provider>
617
       </provider>

+ 45
- 4
arraz/src/main/java/Arraz.java Bestand weergeven

104
     public int[] insertArrayAt(int[] array, int index, int value){
104
     public int[] insertArrayAt(int[] array, int index, int value){
105
         int[] newArray = new int[array.length + 1];
105
         int[] newArray = new int[array.length + 1];
106
         int counter = 0;
106
         int counter = 0;
107
-        for (int i = 0; i < array.length-1; i++) {
108
-            if (i == index){
109
-                newArray[index] = value;
107
+        for (int i = 0; i < array.length; i++) {
108
+            if (counter == index){
109
+                newArray[counter] = value;
110
                 counter++;
110
                 counter++;
111
-            }else {
111
+                i--;
112
+            }else{
112
                 newArray[counter] = array[i];
113
                 newArray[counter] = array[i];
113
                 counter++;
114
                 counter++;
114
             }
115
             }
157
                 return true;
158
                 return true;
158
             }else{return false;}
159
             }else{return false;}
159
     }
160
     }
161
+
162
+    public boolean theTotalOfTenIs30(Integer[] array){
163
+        int sum10 = 0;
164
+        for (Integer each:array){
165
+            if(each == 10){
166
+                sum10 += each;
167
+                if(sum10 == 30){
168
+                    return true;
169
+                }
170
+            }
171
+        }
172
+        return false;
173
+    }
174
+
175
+    public Integer[] min2Array(Integer[] array){
176
+        Set<Integer> minSet = new TreeSet<>(Arrays.asList(array));
177
+        return Arrays.copyOfRange(minSet.toArray(new Integer[0]), 0, 2);
178
+    }
179
+
180
+    public int[] reverseCopy(int[] array){
181
+       return reverseArray(array);
182
+    }
183
+
184
+    public int[] removeLastItemCopy(int[] array){
185
+        return removeElementFromArray(array, array[array.length-1]);
186
+    }
187
+
188
+    public int[] removeFirstItemCopy(int[] array){
189
+        return removeElementFromArray(array, array[0]);
190
+    }
191
+
192
+    public int[] insertStartCopy(int[] array, int value){
193
+        return insertArrayAt(array, 0, value);
194
+    }
195
+
196
+    public Integer[] insertEndCopy(Integer[] array, int value){
197
+        List<Integer> list = new ArrayList<>(Arrays.asList(array));
198
+        list.add(value);
199
+        return list.toArray(new Integer[0]);
200
+    }
160
 }
201
 }

+ 114
- 5
arraz/src/test/java/ArrazTest.java Bestand weergeven

3
 import org.junit.Assert;
3
 import org.junit.Assert;
4
 import org.junit.Before;
4
 import org.junit.Before;
5
 import org.junit.Test;
5
 import org.junit.Test;
6
-
7
 import java.util.ArrayList;
6
 import java.util.ArrayList;
8
 import java.util.Arrays;
7
 import java.util.Arrays;
9
 import java.util.List;
8
 import java.util.List;
197
 
196
 
198
     @Test
197
     @Test
199
     public void testInsertArrayAt1(){
198
     public void testInsertArrayAt1(){
200
-        int[] expected = new int[]{5, 10, 17, 3, 29, 100};
201
-        int[] actual = testArraz.insertArrayAt(arr1, 2, 17);
199
+        int[] expected = new int[]{5, 10, 3, 17, 29, 100};
200
+        int[] actual = testArraz.insertArrayAt(arr1, 3, 17);
201
+        System.out.println(Arrays.toString(actual));
202
 
202
 
203
         Assert.assertArrayEquals(expected, actual);
203
         Assert.assertArrayEquals(expected, actual);
204
     }
204
     }
205
 
205
 
206
     @Test
206
     @Test
207
     public void testInsertArrayAt2(){
207
     public void testInsertArrayAt2(){
208
-        int[] expected =  new int[]{2, 7, 432, 89, 6};
209
-        int[] actual = testArraz.insertArrayAt(arr2, 4, 6);
208
+        int[] expected =  new int[]{2, 6, 7, 432, 89};
209
+        int[] actual = testArraz.insertArrayAt(arr2, 1, 6);
210
+        System.out.println(Arrays.toString(actual));
210
 
211
 
211
         Assert.assertArrayEquals(expected, actual);
212
         Assert.assertArrayEquals(expected, actual);
212
     }
213
     }
352
         Assert.assertFalse(testArraz.arrayHas65and77(array));
353
         Assert.assertFalse(testArraz.arrayHas65and77(array));
353
     }
354
     }
354
 
355
 
356
+    @Test
357
+    public void testTheTotalOfTenIs301() {
358
+        Integer[] array = new Integer[]{10, 4, 3, 10, 56, 10};
359
+        Assert.assertTrue(testArraz.theTotalOfTenIs30(array));
360
+    }
361
+
362
+    @Test
363
+    public void testTheTotalOfTenIs302(){
364
+        Integer[] array = new Integer[]{10, 98, 2, 34,10};
365
+        Assert.assertFalse(testArraz.theTotalOfTenIs30(array));
366
+    }
367
+
368
+    @Test
369
+    public void testMin2Array1(){
370
+        Integer[] expected = new Integer[]{3, 5};
371
+        Integer[] actual = testArraz.min2Array(new Integer[]{100, 54, 10, 78, 10, 5, 3});
372
+
373
+        Assert.assertArrayEquals(expected, actual);
374
+    }
375
+
376
+    @Test
377
+    public void testMin2Array(){
378
+        Integer[] expected = new Integer[]{1, 10};
379
+        Integer[] actual = testArraz.min2Array(new Integer[]{1,1,1,1,10});
380
+
381
+        Assert.assertArrayEquals(expected, actual);
382
+    }
383
+
384
+    @Test
385
+    public void testReverseCopy1(){
386
+        int[] expected = new int[]{100, 29, 3, 10, 5};
387
+        int[] actual = testArraz.reverseCopy(arr1);
388
+
389
+        Assert.assertArrayEquals(expected,actual);
390
+    }
391
+
392
+    @Test
393
+    public void testReverseCopy2(){
394
+        int[] expected = new int[]{89, 432, 7, 2};
395
+        int[] actual = testArraz.reverseCopy(arr2);
396
+
397
+        Assert.assertArrayEquals(expected, actual);
398
+    }
399
+
400
+    @Test
401
+    public void testRemoveLastItemCopy1(){
402
+        int[] expected = new int[]{5, 10, 3, 29};
403
+        int[] actual = testArraz.removeLastItemCopy(arr1);
404
+
405
+        Assert.assertArrayEquals(expected, actual);
406
+    }
407
+
408
+    @Test
409
+    public void testRemoveLastItemCopy2(){
410
+        int[] expected =  new int[]{2, 7, 432};
411
+        int[] actual = testArraz.removeLastItemCopy(arr2);
412
+
413
+        Assert.assertArrayEquals(expected, actual);
414
+    }
415
+
416
+    @Test
417
+    public void testRemoveFirstItemCopy1(){
418
+        int[] expected = new int[]{7, 432, 89};
419
+        int[] actual = testArraz.removeFirstItemCopy(arr2);
420
+
421
+        Assert.assertArrayEquals(expected, actual);
422
+    }
423
+
424
+    @Test
425
+    public void testRemoveFirstItemCopy2(){
426
+        int[] expected = new int[]{10, 3, 29, 100};
427
+        int[] actual = testArraz.removeFirstItemCopy(arr1);
428
+
429
+        Assert.assertArrayEquals(expected, actual);
430
+    }
431
+
432
+    @Test
433
+    public void testInsertStartCopy1(){
434
+        int[] expected = new int[]{4, 5, 10, 3, 29, 100};
435
+        int[] actual = testArraz.insertStartCopy(arr1, 4);
436
+
437
+        Assert.assertArrayEquals(expected, actual);
438
+    }
439
+
440
+    @Test
441
+    public void testInsertStartCopy2(){
442
+        int[] expected = new int[]{56, 2, 7, 432, 89};
443
+        int[] actual = testArraz.insertStartCopy(arr2, 56);
444
+
445
+        Assert.assertArrayEquals(expected, actual);
446
+    }
447
+
448
+    @Test
449
+    public void testInsertEndCopy1(){
450
+        Integer[] expected = new Integer[]{2, 7, 432, 89, 9};
451
+        Integer[] actual = testArraz.insertEndCopy(new Integer[]{2, 7, 432, 89}, 9);
452
+
453
+        Assert.assertArrayEquals(expected, actual);
454
+    }
455
+
456
+    @Test
457
+    public void testInsertEndCopy2(){
458
+        Integer[] expected = new Integer[]{5, 10, 3, 29, 100, 90};
459
+        Integer[] actual = testArraz.insertEndCopy(new Integer[]{5, 10, 3, 29, 100}, 90);
460
+        System.out.println(Arrays.toString(actual));
461
+
462
+        Assert.assertArrayEquals(expected, actual);
463
+    }
355
 }
464
 }