Java Utililty Methods List Remove Null Value

List of utility methods to do List Remove Null Value

Description

The list of methods to do List Remove Null Value are organized into topic(s).

Method

voidremoveNull(Collection list)
remove Null
if (list == null || list.size() == 0) {
    return;
Iterator<Object> iter = list.iterator();
while (iter.hasNext()) {
    if (iter.next() == null) {
        iter.remove();
voidremoveNull(final List list)
remove Null
boolean removed = list.remove(null);
while (removed) {
    removed = list.remove(null);
ListremoveNull(List list)
remove Null
List nullFreeList = new ArrayList();
for (int i = 0; i < list.size(); i++) {
    if (list.get(i) != null) {
        nullFreeList.add(list.get(i));
return nullFreeList;
ListremoveNullableItems(List exceptIds)
remove Nullable Items
List<Long> exceptPermissionIds;
if (exceptIds == null) {
    exceptPermissionIds = null;
} else {
    exceptPermissionIds = new ArrayList<Long>();
    for (Long exceptId : exceptIds) {
        if (exceptId != null) {
            exceptPermissionIds.add(exceptId);
...
ListremoveNullAndDuplicates(List list)
remove Null And Duplicates
list.removeAll(Collections.singletonList(null));
Set set = new LinkedHashSet(list);
return new ArrayList(set);
ListremoveNullElement(List source)
Removes all of the 'null' elements in a list, recursively.
if (!containsNullElement(source))
    return source;
while (source.contains(null)) {
    source.remove(null);
return source;
ListremoveNullElements(List list)
remove Null Elements
List newList = new ArrayList(list.size());
for (Object element : list) {
    if (element != null) {
        newList.add(element);
return newList;
voidremoveNullFromList(List list)
remove Null From List
list.removeAll(Collections.singleton(null));
voidremoveNulls(Collection list)
remove Nulls
for (Iterator<T> iter = list.iterator(); iter.hasNext();) {
    T e = iter.next();
    if (e == null)
        iter.remove();
ListremoveNulls(final List list)
Removes all null elements from list.
if (list == null) {
    return null;
for (int i = list.size() - 1; i >= 0; i--) {
    if (list.get(i) == null) {
        list.remove(i);
return list;