Java Collection Null removeNull(Collection collection)

Here you can find the source of removeNull(Collection collection)

Description

remove Null

License

Apache License

Declaration

public static <T> boolean removeNull(Collection<T> collection) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static <T> boolean removeNull(Collection<T> collection) {
        return collection.removeAll(Collections.singleton(null));
        // jdk 8//from   ww  w. j  a va2 s.c om
        // collection.parallelStream().filter(i -> i != null).collect(Collectors.toList());
        //  list.stream().filter(i -> i != null).collect(Collectors.toList());
        // listWithoutNulls.removeIf(p -> p == null);
    }
}

Related

  1. nullSafeCollection(Collection source)
  2. nullSafeSize(Collection collection)
  3. nullSafeSize(final Collection collection)
  4. padWithNulls(final Collection s1, final Collection s2)
  5. removeAllIfNotNull(final Collection collection, final Collection c)
  6. removeNull(final Collection c)
  7. removeNullElement(Collection collection)
  8. removeNulls(Collection p_collection)
  9. removeNulls(F collection)