List of utility methods to do Collection Empty
boolean | nullOrEmpty(Collection Indicates whether a collection is null or empty. return null == c || c.isEmpty();
|
boolean | nullOrEmpty(final Collection null Or Empty if ((in == null) || (in.isEmpty())) { return true; return false; |
Collection | nullOrEmptyToDefault(final Collection Returns the given collection or the given default collection if the collection is null or empty if (collection == null || collection.isEmpty()) { return defaultValue; return collection; |
Collection | nullToEmpty(Collection Returns either c or an empty collection if c is null . return (c == null ? (Collection<T>) Collections.emptyList() : c);
|
Collection | nullToEmpty(Collection coll) null To Empty return coll == null ? Collections.EMPTY_LIST : coll;
|
Collection | orEmpty(T collection) or Empty return (collection == null ? (Collection<V>) Collections.emptyList() : collection);
|
String[] | removeEmptyStrings(Collection Remove empty strings from a collection. List<String> result = new ArrayList<>(); for (String element : data) { if (element == null || element.isEmpty()) { continue; result.add(element); return result.toArray(new String[result.size()]); ... |
boolean | safeIsEmpty(Collection collection) safe Is Empty return collection == null || collection.isEmpty();
|