|
|
@@ -30,9 +30,6 @@ public class StringArrayUtils {
|
|
30
|
30
|
for(int i = 0; i < array.length -1; i++){
|
|
31
|
31
|
|
|
32
|
32
|
return word = array[array.length-1];
|
|
33
|
|
-
|
|
34
|
|
-
|
|
35
|
|
-
|
|
36
|
33
|
}
|
|
37
|
34
|
return word;
|
|
38
|
35
|
}
|
|
|
@@ -70,15 +67,14 @@ public class StringArrayUtils {
|
|
70
|
67
|
* @return an array with identical contents in reverse order
|
|
71
|
68
|
*/ // TODO
|
|
72
|
69
|
public static String[] reverse(String[] array) {
|
|
73
|
|
- String [] t = new String [array.length];
|
|
74
|
|
- for(int i = 0 ;i<array.length;i++){
|
|
75
|
|
- t[i] = "";
|
|
76
|
|
- for(int j = array[i].length()-1; j>= 0;j--){
|
|
77
|
|
- t[i] +=array[i].substring(j,j+1);
|
|
78
|
|
- }
|
|
|
70
|
+
|
|
|
71
|
+ for(int i = 0 ;i<array.length/2;i++){
|
|
|
72
|
+ String temparray = array[i];
|
|
|
73
|
+ array[i] = array[array.length -1 - i];
|
|
|
74
|
+ array[array.length - 1 - i] = temparray;
|
|
79
|
75
|
}
|
|
80
|
|
-
|
|
81
|
|
- return t;
|
|
|
76
|
+ return array;
|
|
|
77
|
+
|
|
82
|
78
|
}
|
|
83
|
79
|
|
|
84
|
80
|
/**
|
|
|
@@ -86,21 +82,36 @@ public class StringArrayUtils {
|
|
86
|
82
|
* @return true if the order of the array is the same backwards and forwards
|
|
87
|
83
|
*/ // TODO
|
|
88
|
84
|
public static boolean isPalindromic(String[] array) {
|
|
89
|
|
- String length = array.length;
|
|
|
85
|
+ /*
|
|
|
86
|
+ * I'm trying to reverse the order of the array
|
|
|
87
|
+ * than compare if array is equals to array
|
|
|
88
|
+ */
|
|
|
89
|
+ boolean returnPal = true;
|
|
|
90
|
+ String [] reverseArray = reverse(array);
|
|
|
91
|
+ /*
|
|
|
92
|
+ *
|
|
|
93
|
+ */
|
|
|
94
|
+ for(String i:array){
|
|
|
95
|
+ if (reverseArray.equals(array)){
|
|
|
96
|
+ returnPal = false;
|
|
90
|
97
|
|
|
91
|
|
- for(int i = 0;i<length;i++){
|
|
92
|
|
- String start = array[0];
|
|
93
|
|
- String end = array[length];
|
|
|
98
|
+ }
|
|
94
|
99
|
}
|
|
95
|
100
|
|
|
96
|
|
- return false;
|
|
|
101
|
+ return returnPal;
|
|
97
|
102
|
}
|
|
98
|
|
-
|
|
99
|
103
|
/**
|
|
100
|
104
|
* @param array array of String objects
|
|
101
|
105
|
* @return true if each letter in the alphabet has been used in the array
|
|
102
|
106
|
*/ // TODO
|
|
103
|
107
|
public static boolean isPangramic(String[] array) {
|
|
|
108
|
+ /*int letters = 26;
|
|
|
109
|
+ if(isPangramic.length() < letters){
|
|
|
110
|
+ }
|
|
|
111
|
+ *
|
|
|
112
|
+ */
|
|
|
113
|
+
|
|
|
114
|
+
|
|
104
|
115
|
return false;
|
|
105
|
116
|
}
|
|
106
|
117
|
|
|
|
@@ -110,6 +121,9 @@ public class StringArrayUtils {
|
|
110
|
121
|
* @return number of occurrences the specified `value` has occurred
|
|
111
|
122
|
*/ // TODO
|
|
112
|
123
|
public static int getNumberOfOccurrences(String[] array, String value) {
|
|
|
124
|
+ /*
|
|
|
125
|
+ *
|
|
|
126
|
+ */
|
|
113
|
127
|
return 0;
|
|
114
|
128
|
}
|
|
115
|
129
|
|