Java List Remove Null Value removeNull(List list)

Here you can find the source of removeNull(List list)

Description

remove Null

License

BSD License

Parameter

Parameter Description
list a parameter

Declaration

public static List removeNull(List list) 

Method Source Code

//package com.java2s;
/*L/*from  www  . j a v a 2 s  .co  m*/
 * Copyright Washington University in St. Louis, SemanticBits, Persistent Systems, Krishagni.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/wustl-common-package/LICENSE.txt for details.
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
    * @param list
    * @return
    */
    public static List removeNull(List list) {
        List nullFreeList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) != null) {
                nullFreeList.add(list.get(i));
            }
        }
        return nullFreeList;
    }
}

Related

  1. removeNull(Collection list)
  2. removeNull(final List list)
  3. removeNullableItems(List exceptIds)
  4. removeNullAndDuplicates(List list)
  5. removeNullElement(List source)
  6. removeNullElements(List list)

  7. HOME | Copyright © www.java2s.com 2016