Java Collection Null removeNullElement(Collection collection)

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

Description

remove Null Element

License

BSD License

Declaration

public static <T> Collection<T> removeNullElement(Collection<T> collection) 

Method Source Code

//package com.java2s;
/*L//from w w w.  j a v a  2s. co  m
 *  Copyright SAIC, Ellumen and RSNA (CTP)
 *
 *
 *  Distributed under the OSI-approved BSD 3-Clause License.
 *  See http://ncip.github.com/national-biomedical-image-archive/LICENSE.txt for details.
 */

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static <T> Collection<T> removeNullElement(Collection<T> collection) {
        Collection<T> result = new ArrayList<T>();
        for (T t : collection) {
            if (t != null) {
                result.add(t);
            }
        }
        return result;
    }
}

Related

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