List of utility methods to do Array Empty Check
boolean | isNullOrEmptyOrFirstElementBlank(String[] values) is Null Or Empty Or First Element Blank return isArrayNullOrEmpty(values) || values[0].equals(""); |
String[] | normalizeTokens(String[] tokens, boolean removeEmpty) normalize Tokens for (int i = 0; i < tokens.length; i++) { tokens[i] = normalizeString(tokens[i]); if (removeEmpty) { tokens = removeEmpty(tokens); return tokens; |
boolean | nullOrEmpty(Object[] array) null Or Empty return (array == null) || (array.length == 0);
|
String[] | removeEmpty(String[] strings) Removes nulls and empty strings from the given string array. String[] result = new String[strings.length]; int copied = 0; for (String s : strings) { if (s != null && !s.isEmpty()) { result[copied++] = s; return copied == result.length ? result : Arrays.copyOf(result, copied); ... |
String[] | removeEmptyElements(String[] firstArray) Removes empty (or null) element from a given string array and returns a copy without thouse elements List<String> stringList = new ArrayList<String>(); for (String string : firstArray) { if (string != null && string.trim().length() > 0) { stringList.add(string); firstArray = stringList.toArray(new String[stringList.size()]); return firstArray; ... |
String[] | removeEmptyEntries(String[] array) remove Empty Entries if (array == null || array.length == 0) { return array; List<String> result = new ArrayList<String>(); for (String entry : array) { entry = removeEmptyEntry(entry); if (entry != null) { result.add(entry); ... |
ArrayList | removeEmptyLines(String lines[]) remove Empty Lines ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < lines.length; i++) { if (!lines[i].trim().isEmpty()) { result.add(lines[i]); return result; |
String[] | removeEmptyString(final String[] words) Removes empty Strings from the given string array and gives it back. List<String> al = new ArrayList<String>(); for (int i = 0; i < words.length; i++) { if (!words[i].isEmpty()) { al.add(words[i]); return al.toArray(new String[al.size()]); |
String[] | removeEmptyString(String[] strOrigin) Remove empty string elements from origin string array List<String> strList = new ArrayList<String>(); for (String str : strOrigin) { if (str != null && !str.trim().isEmpty()) { strList.add(str); return strList.toArray(new String[0]); |
String[] | removeEmptyStrings(String[] data) Removes empty or null strings from an array ArrayList<String> result = new ArrayList<String>(); for (int k = 0; k < data.length; k++) if (!data[k].equals("")) result.add(data[k]); String[] res = new String[result.size()]; result.toArray(res); return res; |