Kaynağa Gözat

one method left

mpierse 8 yıl önce
ebeveyn
işleme
ffd0f5c1dc

+ 12
- 2
src/main/java/com/zipcodewilmington/StringArrayUtils.java Dosyayı Görüntüle

152
      * @return array of Strings with consecutive duplicates removes
152
      * @return array of Strings with consecutive duplicates removes
153
      */ // TODO
153
      */ // TODO
154
     public static String[] removeConsecutiveDuplicates(String[] array) {
154
     public static String[] removeConsecutiveDuplicates(String[] array) {
155
+        String[] tempArr = new String[array.length];
156
+        int counter = 0;
157
+        for (int i=0; i<array.length-1; i++){
158
+            if (array[i].equals(array[i+1])){
159
+                continue;
160
+            } else {
161
+                tempArr[counter++]=array[i];
162
+            }
163
+           // int decrement = tempArr.indexOf(null);
164
+        }
155
 
165
 
156
-        
157
-
166
+        System.out.print(tempArr);
167
+return array;
158
     }
168
     }
159
 
169
 
160
     /**
170
     /**