List of utility methods to do List Null Empty
List | newListIfNull(List new List If Null if (list == null) { return new ArrayList<T>(); } else { return list; |
List | newListWhenNull(List new List When Null if (isEmpty(list)) { list = new ArrayList<T>(); return list; |
ArrayList | newListWithOneNull() new List With One Null ArrayList<T> newList = new ArrayList<T>(); newList.add(null); return newList; |
boolean | nullOrEmpty(List Check if List is null or empty return s == null || s.isEmpty();
|
boolean | nullOrEmptyList(List> list) Determine if a List is null or empty. return (list == null) || list.isEmpty();
|
void | nullSafeAdd(List null Safe Add if (list != null) {
list.add(elem);
|
List | nullsafeAsList(T... elements) nullsafe As List return elements == null ? null : Arrays.asList(elements);
|
List | nullSafeList(List Always returns a non-null list - either the argument list or a new empty list. return list != null ? list : Collections.<O>emptyList();
|
List | nullToEmpty(List null To Empty return in == null ? Collections.<T>emptyList() : in;
|
List | nullToEmpty(List null To Empty return list == null ? Collections.emptyList() : list;
|