|
|
@@ -82,20 +82,20 @@ public class StringArrayUtils {
|
|
82
|
82
|
* @return true if each letter in the alphabet has been used in the array
|
|
83
|
83
|
*/ // TODO
|
|
84
|
84
|
public static boolean isPangramic(String[] array) {
|
|
85
|
|
- ArrayList<Character> Chars = new ArrayList<Character>();
|
|
|
85
|
+
|
|
|
86
|
+ ArrayList<Character> alpha = new ArrayList<Character>();
|
|
86
|
87
|
|
|
87
|
88
|
for(String str: array){
|
|
88
|
|
- char[] chars = str.toCharArray();
|
|
|
89
|
+ char[] chars = str.toLowerCase().replace(" ", "").toCharArray();
|
|
89
|
90
|
|
|
90
|
91
|
for(char car : chars){
|
|
91
|
|
- if(!Chars.contains(car)){
|
|
92
|
|
- Chars.add(car);
|
|
|
92
|
+ if(!alpha.contains(car)){
|
|
|
93
|
+ alpha.add(car);
|
|
93
|
94
|
}
|
|
94
|
95
|
}
|
|
95
|
|
-
|
|
96
|
96
|
}
|
|
97
|
97
|
|
|
98
|
|
- return Chars.size() == 26 ? true : false;
|
|
|
98
|
+ return alpha.size() == 26 ? true : false;
|
|
99
|
99
|
}
|
|
100
|
100
|
|
|
101
|
101
|
|
|
|
@@ -151,19 +151,13 @@ public class StringArrayUtils {
|
|
151
|
151
|
* @return array of Strings with each consecutive duplicate occurrence concatenated as a single string in an array of Strings
|
|
152
|
152
|
*/ // TODO
|
|
153
|
153
|
public static String[] packConsecutiveDuplicates(String[] array) {
|
|
154
|
|
- ArrayList<String> strings = new ArrayList<String>();
|
|
|
154
|
+ ArrayList<String> strings = new ArrayList<String>();
|
|
155
|
155
|
|
|
156
|
|
- boolean isDuplicated;
|
|
157
|
|
- for(String str1: array){
|
|
158
|
|
- isDuplicated = false;
|
|
159
|
|
- for(String str2: array){
|
|
160
|
|
- if(str1 == str2){
|
|
161
|
|
- isDuplicated = true;
|
|
162
|
|
- }
|
|
163
|
|
- }
|
|
164
|
|
- if(!isDuplicated){
|
|
165
|
|
- strings.add(str1);
|
|
|
156
|
+ for(int i = 0; i < array.length; i++){
|
|
|
157
|
+ for(int j = i; j < array.length; j++){
|
|
|
158
|
+
|
|
166
|
159
|
}
|
|
|
160
|
+
|
|
167
|
161
|
}
|
|
168
|
162
|
|
|
169
|
163
|
return strings.toArray(new String[strings.size()]);
|