List of utility methods to do Collection Null
F | removeNulls(F collection) remove Nulls Iterator<E> iterator = collection.iterator(); while (iterator.hasNext()) { if (iterator.next() == null) { iterator.remove(); return collection; |
void | removeNulls(final Collection> collection) remove Nulls for (final Iterator<?> iter = collection.iterator(); iter.hasNext();) { if (iter.next() == null) { iter.remove(); |
List | sortNumbers(Collection Utility method which takes a Collection of Numbers, and returns this back as a List, in order of each Number's double value If removeNull is true, null values will be ignored and not returned If removeNull is false, null values will be sorted to the end of the list List<T> valueList = new ArrayList<T>(values); if (removeNull) { values.remove(null); Collections.sort(valueList, new Comparator<T>() { public int compare(T n1, T n2) { if (n1 == null) { return n2 == null ? 0 : 1; ... |
void | stripNulls(T collection) strip Nulls Iterator<?> iterator = collection.iterator(); while (iterator.hasNext()) { if (iterator.next() == null) iterator.remove(); |
T | trimToNull(T collection) trim To Null return isEmpty(collection) ? null : collection;
|