Browse Source

Up to AvWithoutMaxMin

Nathan Hall 6 years ago
parent
commit
2e57de5d74
3 changed files with 204 additions and 66 deletions
  1. 79
    66
      arraz/.idea/workspace.xml
  2. 33
    0
      arraz/src/main/java/Arraz.java
  3. 92
    0
      arraz/src/test/java/ArrazTest.java

+ 79
- 66
arraz/.idea/workspace.xml View File

28
       </usages-collector>
28
       </usages-collector>
29
       <usages-collector id="statistics.file.types.edit">
29
       <usages-collector id="statistics.file.types.edit">
30
         <counts>
30
         <counts>
31
-          <entry key="JAVA" value="4534" />
31
+          <entry key="JAVA" value="5436" />
32
         </counts>
32
         </counts>
33
       </usages-collector>
33
       </usages-collector>
34
     </session>
34
     </session>
35
   </component>
35
   </component>
36
   <component name="FileEditorManager">
36
   <component name="FileEditorManager">
37
-    <splitter split-orientation="horizontal" split-proportion="0.5571332">
37
+    <splitter split-orientation="horizontal" split-proportion="0.5280499">
38
       <split-first>
38
       <split-first>
39
         <leaf>
39
         <leaf>
40
           <file pinned="false" current-in-tab="true">
40
           <file pinned="false" current-in-tab="true">
41
             <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
41
             <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
42
               <provider selected="true" editor-type-id="text-editor">
42
               <provider selected="true" editor-type-id="text-editor">
43
-                <state relative-caret-position="94">
44
-                  <caret line="108" column="18" selection-start-line="108" selection-start-column="18" selection-end-line="108" selection-end-column="18" />
43
+                <state relative-caret-position="206">
44
+                  <caret line="224" column="23" lean-forward="true" selection-start-line="224" selection-start-column="23" selection-end-line="224" selection-end-column="23" />
45
                   <folding>
45
                   <folding>
46
                     <element signature="e#1659#1668#0" expanded="true" />
46
                     <element signature="e#1659#1668#0" expanded="true" />
47
+                    <element signature="e#2355#2364#0" expanded="true" />
48
+                    <element signature="e#2800#2801#0" expanded="true" />
49
+                    <element signature="e#2828#2829#0" expanded="true" />
47
                     <element signature="e#1375#1376#0" expanded="true" />
50
                     <element signature="e#1375#1376#0" expanded="true" />
48
                     <element signature="e#1410#1411#0" expanded="true" />
51
                     <element signature="e#1410#1411#0" expanded="true" />
49
                     <element signature="e#1454#1455#0" expanded="true" />
52
                     <element signature="e#1454#1455#0" expanded="true" />
68
           <file pinned="false" current-in-tab="true">
71
           <file pinned="false" current-in-tab="true">
69
             <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
72
             <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
70
               <provider selected="true" editor-type-id="text-editor">
73
               <provider selected="true" editor-type-id="text-editor">
71
-                <state relative-caret-position="96">
72
-                  <caret line="339" column="15" selection-start-line="339" selection-start-column="15" selection-end-line="339" selection-end-column="15" />
74
+                <state relative-caret-position="197">
75
+                  <caret line="292" column="35" lean-forward="true" selection-start-line="292" selection-start-column="35" selection-end-line="292" selection-end-column="35" />
73
                   <folding>
76
                   <folding>
74
                     <element signature="imports" expanded="true" />
77
                     <element signature="imports" expanded="true" />
78
+                    <element signature="e#7644#7653#0" expanded="true" />
79
+                    <element signature="e#8053#8062#0" expanded="true" />
80
+                    <element signature="e#8057#8066#0" expanded="true" />
81
+                    <element signature="e#8728#8737#0" expanded="true" />
75
                   </folding>
82
                   </folding>
76
                 </state>
83
                 </state>
77
               </provider>
84
               </provider>
87
   <component name="IdeDocumentHistory">
94
   <component name="IdeDocumentHistory">
88
     <option name="CHANGED_PATHS">
95
     <option name="CHANGED_PATHS">
89
       <list>
96
       <list>
90
-        <option value="$PROJECT_DIR$/src/main/java/Arraz.java" />
91
         <option value="$PROJECT_DIR$/src/test/java/ArrazTest.java" />
97
         <option value="$PROJECT_DIR$/src/test/java/ArrazTest.java" />
98
+        <option value="$PROJECT_DIR$/src/main/java/Arraz.java" />
92
       </list>
99
       </list>
93
     </option>
100
     </option>
94
   </component>
101
   </component>
99
     <sorting>DEFINITION_ORDER</sorting>
106
     <sorting>DEFINITION_ORDER</sorting>
100
   </component>
107
   </component>
101
   <component name="ProjectFrameBounds">
108
   <component name="ProjectFrameBounds">
102
-    <option name="y" value="159" />
109
+    <option name="x" value="21" />
110
+    <option name="y" value="214" />
103
     <option name="width" value="1280" />
111
     <option name="width" value="1280" />
104
     <option name="height" value="747" />
112
     <option name="height" value="747" />
105
   </component>
113
   </component>
158
   <component name="PropertiesComponent">
166
   <component name="PropertiesComponent">
159
     <property name="WebServerToolWindowFactoryState" value="false" />
167
     <property name="WebServerToolWindowFactoryState" value="false" />
160
     <property name="aspect.path.notification.shown" value="true" />
168
     <property name="aspect.path.notification.shown" value="true" />
161
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544154073764" />
169
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544159948022" />
162
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
170
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
163
     <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" />
164
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
172
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
175
       </list>
183
       </list>
176
     </option>
184
     </option>
177
   </component>
185
   </component>
178
-  <component name="RunManager" selected="JUnit.ArrazTest.test2Find2ndLargestValueFromArray">
179
-    <configuration name="ArrazTest.test2Find2ndLargestValueFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
186
+  <component name="RunManager" selected="JUnit.ArrazTest">
187
+    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
180
       <module name="arraz" />
188
       <module name="arraz" />
181
       <option name="PACKAGE_NAME" value="" />
189
       <option name="PACKAGE_NAME" value="" />
182
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
190
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
183
-      <option name="METHOD_NAME" value="test2Find2ndLargestValueFromArray" />
184
-      <option name="TEST_OBJECT" value="method" />
185
       <method v="2">
191
       <method v="2">
186
         <option name="Make" enabled="true" />
192
         <option name="Make" enabled="true" />
187
       </method>
193
       </method>
188
     </configuration>
194
     </configuration>
189
-    <configuration name="ArrazTest.test2FindMaxMinOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
195
+    <configuration name="ArrazTest.test2Check2ArraysForEqual" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
190
       <module name="arraz" />
196
       <module name="arraz" />
191
       <option name="PACKAGE_NAME" value="" />
197
       <option name="PACKAGE_NAME" value="" />
192
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
198
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
193
-      <option name="METHOD_NAME" value="test2FindMaxMinOfArray" />
199
+      <option name="METHOD_NAME" value="test2Check2ArraysForEqual" />
194
       <option name="TEST_OBJECT" value="method" />
200
       <option name="TEST_OBJECT" value="method" />
195
       <method v="2">
201
       <method v="2">
196
         <option name="Make" enabled="true" />
202
         <option name="Make" enabled="true" />
197
       </method>
203
       </method>
198
     </configuration>
204
     </configuration>
199
-    <configuration name="ArrazTest.test2RemoveDupesFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
205
+    <configuration name="ArrazTest.test2MakeMeAnArrayFromArrayList" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
200
       <module name="arraz" />
206
       <module name="arraz" />
201
       <option name="PACKAGE_NAME" value="" />
207
       <option name="PACKAGE_NAME" value="" />
202
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
208
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
203
-      <option name="METHOD_NAME" value="test2RemoveDupesFromArray" />
209
+      <option name="METHOD_NAME" value="test2MakeMeAnArrayFromArrayList" />
204
       <option name="TEST_OBJECT" value="method" />
210
       <option name="TEST_OBJECT" value="method" />
205
       <method v="2">
211
       <method v="2">
206
         <option name="Make" enabled="true" />
212
         <option name="Make" enabled="true" />
207
       </method>
213
       </method>
208
     </configuration>
214
     </configuration>
209
-    <configuration name="ArrazTest.testFind2ndLargestValueFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
215
+    <configuration name="ArrazTest.test2MakeMeAnArrayListFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
210
       <module name="arraz" />
216
       <module name="arraz" />
211
       <option name="PACKAGE_NAME" value="" />
217
       <option name="PACKAGE_NAME" value="" />
212
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
218
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
213
-      <option name="METHOD_NAME" value="testFind2ndLargestValueFromArray" />
219
+      <option name="METHOD_NAME" value="test2MakeMeAnArrayListFromArray" />
214
       <option name="TEST_OBJECT" value="method" />
220
       <option name="TEST_OBJECT" value="method" />
215
       <method v="2">
221
       <method v="2">
216
         <option name="Make" enabled="true" />
222
         <option name="Make" enabled="true" />
217
       </method>
223
       </method>
218
     </configuration>
224
     </configuration>
219
-    <configuration name="ArrazTest.testRemoveDupesFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
225
+    <configuration name="ArrazTest.testCheck2ArraysForEqual" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
220
       <module name="arraz" />
226
       <module name="arraz" />
221
       <option name="PACKAGE_NAME" value="" />
227
       <option name="PACKAGE_NAME" value="" />
222
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
228
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
223
-      <option name="METHOD_NAME" value="testRemoveDupesFromArray" />
229
+      <option name="METHOD_NAME" value="testCheck2ArraysForEqual" />
224
       <option name="TEST_OBJECT" value="method" />
230
       <option name="TEST_OBJECT" value="method" />
225
       <method v="2">
231
       <method v="2">
226
         <option name="Make" enabled="true" />
232
         <option name="Make" enabled="true" />
227
       </method>
233
       </method>
228
     </configuration>
234
     </configuration>
229
     <list>
235
     <list>
230
-      <item itemvalue="JUnit.ArrazTest.test2FindMaxMinOfArray" />
231
-      <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray" />
232
-      <item itemvalue="JUnit.ArrazTest.test2RemoveDupesFromArray" />
233
-      <item itemvalue="JUnit.ArrazTest.testFind2ndLargestValueFromArray" />
234
-      <item itemvalue="JUnit.ArrazTest.test2Find2ndLargestValueFromArray" />
236
+      <item itemvalue="JUnit.ArrazTest.test2MakeMeAnArrayListFromArray" />
237
+      <item itemvalue="JUnit.ArrazTest.test2MakeMeAnArrayFromArrayList" />
238
+      <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual" />
239
+      <item itemvalue="JUnit.ArrazTest.test2Check2ArraysForEqual" />
240
+      <item itemvalue="JUnit.ArrazTest" />
235
     </list>
241
     </list>
236
     <recent_temporary>
242
     <recent_temporary>
237
       <list>
243
       <list>
238
-        <item itemvalue="JUnit.ArrazTest.test2Find2ndLargestValueFromArray" />
239
-        <item itemvalue="JUnit.ArrazTest.testFind2ndLargestValueFromArray" />
240
-        <item itemvalue="JUnit.ArrazTest.test2RemoveDupesFromArray" />
241
-        <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray" />
242
-        <item itemvalue="JUnit.ArrazTest.test2FindMaxMinOfArray" />
244
+        <item itemvalue="JUnit.ArrazTest" />
245
+        <item itemvalue="JUnit.ArrazTest.test2Check2ArraysForEqual" />
246
+        <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual" />
247
+        <item itemvalue="JUnit.ArrazTest.test2MakeMeAnArrayFromArrayList" />
248
+        <item itemvalue="JUnit.ArrazTest.test2MakeMeAnArrayListFromArray" />
243
       </list>
249
       </list>
244
     </recent_temporary>
250
     </recent_temporary>
245
   </component>
251
   </component>
253
       <option name="number" value="Default" />
259
       <option name="number" value="Default" />
254
       <option name="presentableId" value="Default" />
260
       <option name="presentableId" value="Default" />
255
       <updated>1544046001151</updated>
261
       <updated>1544046001151</updated>
256
-      <workItem from="1544046022231" duration="21160000" />
262
+      <workItem from="1544046022231" duration="26398000" />
257
     </task>
263
     </task>
258
     <servers />
264
     <servers />
259
   </component>
265
   </component>
260
   <component name="TestHistory">
266
   <component name="TestHistory">
261
-    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 32m 40s.xml">
262
-      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
267
+    <history-entry file="ArrazTest_test2RemoveDupesFromArray - 2018.12.06 at 22h 39m 23s.xml">
268
+      <configuration name="ArrazTest.test2RemoveDupesFromArray" configurationId="JUnit" />
263
     </history-entry>
269
     </history-entry>
264
-    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 21h 55m 22s.xml">
265
-      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
270
+    <history-entry file="ArrazTest_testFind2ndLargestValueFromArray - 2018.12.06 at 22h 39m 28s.xml">
271
+      <configuration name="ArrazTest.testFind2ndLargestValueFromArray" configurationId="JUnit" />
266
     </history-entry>
272
     </history-entry>
267
-    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 21h 55m 58s.xml">
268
-      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
273
+    <history-entry file="ArrazTest_testFind2ndLargestValueFromArray - 2018.12.06 at 22h 40m 59s.xml">
274
+      <configuration name="ArrazTest.testFind2ndLargestValueFromArray" configurationId="JUnit" />
269
     </history-entry>
275
     </history-entry>
270
-    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 21h 59m 30s.xml">
271
-      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
276
+    <history-entry file="ArrazTest_testFind2ndLargestValueFromArray - 2018.12.06 at 22h 41m 16s.xml">
277
+      <configuration name="ArrazTest.testFind2ndLargestValueFromArray" configurationId="JUnit" />
272
     </history-entry>
278
     </history-entry>
273
-    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 22h 10m 25s.xml">
274
-      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
279
+    <history-entry file="ArrazTest_test2Find2ndLargestValueFromArray - 2018.12.06 at 22h 41m 20s.xml">
280
+      <configuration name="ArrazTest.test2Find2ndLargestValueFromArray" configurationId="JUnit" />
275
     </history-entry>
281
     </history-entry>
276
-    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 22h 10m 33s.xml">
277
-      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
282
+    <history-entry file="ArrazTest_testMakeMeAnArrayFromArrayList - 2018.12.06 at 23h 40m 53s.xml">
283
+      <configuration name="ArrazTest.testMakeMeAnArrayFromArrayList" configurationId="JUnit" />
278
     </history-entry>
284
     </history-entry>
279
-    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 22h 15m 48s.xml">
280
-      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
285
+    <history-entry file="ArrazTest_test2MakeMeAnArrayListFromArray - 2018.12.06 at 23h 41m 42s.xml">
286
+      <configuration name="ArrazTest.test2MakeMeAnArrayListFromArray" configurationId="JUnit" />
281
     </history-entry>
287
     </history-entry>
282
-    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 22h 15m 54s.xml">
283
-      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
288
+    <history-entry file="ArrazTest_test2MakeMeAnArrayFromArrayList - 2018.12.06 at 23h 42m 13s.xml">
289
+      <configuration name="ArrazTest.test2MakeMeAnArrayFromArrayList" configurationId="JUnit" />
284
     </history-entry>
290
     </history-entry>
285
-    <history-entry file="ArrazTest_testRemoveDupesFromArray - 2018.12.06 at 22h 31m 40s.xml">
286
-      <configuration name="ArrazTest.testRemoveDupesFromArray" configurationId="JUnit" />
291
+    <history-entry file="ArrazTest_testCheck2ArraysForEqual - 2018.12.06 at 23h 46m 47s.xml">
292
+      <configuration name="ArrazTest.testCheck2ArraysForEqual" configurationId="JUnit" />
287
     </history-entry>
293
     </history-entry>
288
-    <history-entry file="ArrazTest_test2RemoveDupesFromArray - 2018.12.06 at 22h 32m 31s.xml">
289
-      <configuration name="ArrazTest.test2RemoveDupesFromArray" configurationId="JUnit" />
294
+    <history-entry file="ArrazTest_test2Check2ArraysForEqual - 2018.12.06 at 23h 47m 25s.xml">
295
+      <configuration name="ArrazTest.test2Check2ArraysForEqual" configurationId="JUnit" />
290
     </history-entry>
296
     </history-entry>
291
   </component>
297
   </component>
292
   <component name="TimeTrackingManager">
298
   <component name="TimeTrackingManager">
293
-    <option name="totallyTimeSpent" value="21160000" />
299
+    <option name="totallyTimeSpent" value="26398000" />
294
   </component>
300
   </component>
295
   <component name="ToolWindowManager">
301
   <component name="ToolWindowManager">
296
-    <frame x="0" y="159" width="1280" height="747" extended-state="0" />
302
+    <frame x="31" y="130" width="1280" height="747" extended-state="0" />
297
     <editor active="true" />
303
     <editor active="true" />
298
     <layout>
304
     <layout>
299
       <window_info id="Image Layers" />
305
       <window_info id="Image Layers" />
360
         </state>
366
         </state>
361
       </provider>
367
       </provider>
362
     </entry>
368
     </entry>
369
+    <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
370
+      <provider selected="true" editor-type-id="text-editor">
371
+        <state relative-caret-position="197">
372
+          <caret line="292" column="35" lean-forward="true" selection-start-line="292" selection-start-column="35" selection-end-line="292" selection-end-column="35" />
373
+          <folding>
374
+            <element signature="imports" expanded="true" />
375
+            <element signature="e#7644#7653#0" expanded="true" />
376
+            <element signature="e#8053#8062#0" expanded="true" />
377
+            <element signature="e#8057#8066#0" expanded="true" />
378
+            <element signature="e#8728#8737#0" expanded="true" />
379
+          </folding>
380
+        </state>
381
+      </provider>
382
+    </entry>
363
     <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
383
     <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
364
       <provider selected="true" editor-type-id="text-editor">
384
       <provider selected="true" editor-type-id="text-editor">
365
-        <state relative-caret-position="94">
366
-          <caret line="108" column="18" selection-start-line="108" selection-start-column="18" selection-end-line="108" selection-end-column="18" />
385
+        <state relative-caret-position="206">
386
+          <caret line="224" column="23" lean-forward="true" selection-start-line="224" selection-start-column="23" selection-end-line="224" selection-end-column="23" />
367
           <folding>
387
           <folding>
368
             <element signature="e#1659#1668#0" expanded="true" />
388
             <element signature="e#1659#1668#0" expanded="true" />
389
+            <element signature="e#2355#2364#0" expanded="true" />
390
+            <element signature="e#2800#2801#0" expanded="true" />
391
+            <element signature="e#2828#2829#0" expanded="true" />
369
             <element signature="e#1375#1376#0" expanded="true" />
392
             <element signature="e#1375#1376#0" expanded="true" />
370
             <element signature="e#1410#1411#0" expanded="true" />
393
             <element signature="e#1410#1411#0" expanded="true" />
371
             <element signature="e#1454#1455#0" expanded="true" />
394
             <element signature="e#1454#1455#0" expanded="true" />
382
         </state>
405
         </state>
383
       </provider>
406
       </provider>
384
     </entry>
407
     </entry>
385
-    <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
386
-      <provider selected="true" editor-type-id="text-editor">
387
-        <state relative-caret-position="96">
388
-          <caret line="339" column="15" selection-start-line="339" selection-start-column="15" selection-end-line="339" selection-end-column="15" />
389
-          <folding>
390
-            <element signature="imports" expanded="true" />
391
-          </folding>
392
-        </state>
393
-      </provider>
394
-    </entry>
395
   </component>
408
   </component>
396
 </project>
409
 </project>

+ 33
- 0
arraz/src/main/java/Arraz.java View File

117
         return array[array.length - 2];
117
         return array[array.length - 2];
118
     }
118
     }
119
 
119
 
120
+    public ArrayList<Integer> makeMeAnArrayListFromArray(Integer[] array) {
121
+        ArrayList<Integer> al = new ArrayList<Integer>();
122
+
123
+        for (Integer i : array){
124
+            al.add(i);
125
+        }
126
+
127
+        return al;
128
+    }
129
+
130
+    public Integer[] makeMeAnArrayFromArrayList(ArrayList<Integer> al) {
131
+        Integer[] array = new Integer[al.size()];
132
+        int count = 0;
133
+        for (Integer i : al){
134
+            array[count] = i;
135
+            count++;
136
+
137
+        }
138
+
139
+        return array;
140
+    }
141
+
142
+    public boolean check2ArraysForEqual(String[] str1, String[] str2) {
143
+        return Arrays.equals(str1, str2);
144
+    }
145
+
146
+    public Integer averageArrayWithoutMaxMin(Integer[] arr1) {
147
+
148
+//        findMaxMinOfArray((Double) arr1);
149
+
150
+        return null;
151
+    }
152
+
120
     public class OddEven {
153
     public class OddEven {
121
         public int odds;
154
         public int odds;
122
         public int evens;
155
         public int evens;

+ 92
- 0
arraz/src/test/java/ArrazTest.java View File

1
 import org.junit.Assert;
1
 import org.junit.Assert;
2
 import org.junit.Test;
2
 import org.junit.Test;
3
 
3
 
4
+import java.util.ArrayList;
4
 import java.util.Arrays;
5
 import java.util.Arrays;
5
 import java.util.Collections;
6
 import java.util.Collections;
6
 
7
 
352
 
353
 
353
         Assert.assertEquals(expected, actual);
354
         Assert.assertEquals(expected, actual);
354
     }
355
     }
356
+
357
+    @Test
358
+    public void testMakeMeAnArrayListFromArray(){
359
+        Integer[] array = {1,2,3};
360
+        ArrayList<Integer> al = new ArrayList<Integer>();
361
+        al.add(1);
362
+        al.add(2);
363
+        al.add(3);
364
+
365
+        Integer[] expected = {1,2,3};
366
+        ArrayList<Integer> actual = arraz.makeMeAnArrayListFromArray(array);
367
+
368
+        Assert.assertTrue(Arrays.equals(expected, actual.toArray()));
369
+
370
+    }
371
+
372
+    @Test
373
+    public void test2MakeMeAnArrayListFromArray(){
374
+        Integer[] array = {1};
375
+        ArrayList<Integer> al = new ArrayList<Integer>();
376
+        al.add(1);
377
+
378
+        Integer[] expected = {1};
379
+        ArrayList<Integer> actual = arraz.makeMeAnArrayListFromArray(array);
380
+
381
+        Assert.assertTrue(Arrays.equals(expected, actual.toArray()));
382
+
383
+    }
384
+
385
+    @Test
386
+    public void testMakeMeAnArrayFromArrayList(){
387
+
388
+        ArrayList<Integer> al = new ArrayList<Integer>();
389
+        al.add(1);
390
+        al.add(2);
391
+        al.add(3);
392
+
393
+        Integer[] expected = {1,2,3};
394
+        Integer[] actual = arraz.makeMeAnArrayFromArrayList(al);
395
+
396
+        Assert.assertTrue(Arrays.equals(expected, actual));
397
+
398
+    }
399
+
400
+    @Test
401
+    public void test2MakeMeAnArrayFromArrayList(){
402
+
403
+        ArrayList<Integer> al = new ArrayList<Integer>();
404
+        al.add(1);
405
+
406
+        Integer[] expected = {1};
407
+        Integer[] actual = arraz.makeMeAnArrayFromArrayList(al);
408
+
409
+        Assert.assertTrue(Arrays.equals(expected, actual));
410
+
411
+    }
412
+
413
+    @Test
414
+    public void testCheck2ArraysForEqual(){
415
+
416
+        String[] str1 = {"Happy", "Happy", "Joy", "Joy"};
417
+        String[] str2 = {"Happy", "Happy", "Joy", "Joy"};
418
+
419
+        boolean actual = arraz.check2ArraysForEqual(str1, str2);
420
+
421
+        Assert.assertTrue(actual);
422
+    }
423
+
424
+    @Test
425
+    public void test2Check2ArraysForEqual(){
426
+
427
+        String[] str1 = {"Happy", "Happy", "Joy", "Joy"};
428
+        String[] str2 = {"Happy", "Happy", "Joy", "Joo"};
429
+
430
+        boolean actual = arraz.check2ArraysForEqual(str1, str2);
431
+
432
+        Assert.assertFalse(actual);
433
+    }
434
+
435
+    @Test
436
+    public void testAverageArrayWithoutMaxMin(){
437
+
438
+        Integer[] arr1 = {1,2,3,4,5};
439
+
440
+        Integer expected = 3;
441
+        Integer actual = arraz.averageArrayWithoutMaxMin(arr1);
442
+
443
+        Assert.assertEquals(expected, actual);
444
+    }
445
+
446
+
355
 }
447
 }