List of utility methods to do Collection Null
Collection | nullSafe(Collection null Safe if (in == null) { return (Collection<T>) EMPTY_LIST; return in; |
Collection | nullSafeCollection(Collection null Safe Collection return source == null ? Collections.emptyList() : source;
|
int | nullSafeSize(Collection size if (collection == null) { return 0; return collection.size(); |
int | nullSafeSize(final Collection null Safe Size return nullSafeSize(collection, 0);
|
void | padWithNulls(final Collection pad With Nulls if (s1.size() != s2.size()) { while (s1.size() < s2.size()) { s1.add(null); while (s1.size() > s2.size()) { s2.add(null); |
boolean | removeAllIfNotNull(final Collection super E> collection, final Collection extends E> c) remove All If Not Null return (collection != null) && (c != null) && collection.removeAll(c);
|
boolean | removeNull(Collection remove Null return collection.removeAll(Collections.singleton(null));
|
void | removeNull(final Collection> c) remove Null synchronized (c) { for (final Iterator<?> it = c.iterator(); it.hasNext();) { final Object object = it.next(); if (object == null) { it.remove(); |
Collection | removeNullElement(Collection remove Null Element Collection<T> result = new ArrayList<T>(); for (T t : collection) { if (t != null) { result.add(t); return result; |
boolean | removeNulls(Collection p_collection) Removes null objects from the Collection. if (p_collection == null) { return false; boolean removed = false; Iterator it = p_collection.iterator(); while (it.hasNext()) { Object o = it.next(); if (o == null) { ... |