Java List Null Empty listWithoutNull(A... elements)

Here you can find the source of listWithoutNull(A... elements)

Description

list Without Null

License

Open Source License

Declaration

public static <A> List<A> listWithoutNull(A... elements) 

Method Source Code

//package com.java2s;
/*//from  w w  w.  j  a  va2  s.c  o  m
(C) 2007 Stefan Reich (jazz@drjava.de)
This source file is part of Project Prophecy.
For up-to-date information, see http://www.drjava.de/prophecy
    
This source file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.
*/

import java.util.List;
import java.util.ArrayList;

public class Main {
    public static <A> List<A> listWithoutNull(A... elements) {
        List<A> list = new ArrayList<A>();
        for (A a : elements) {
            if (a != null)
                list.add(a);
        }
        return list;
    }
}

Related

  1. isNullOrEmptyList(final List list)
  2. isNullOrEmptyList(List list)
  3. isNullOrEmptyList(String message, List list)
  4. isObjectListEmpty(List list)
  5. listToItemOrNull(List list)
  6. listWithoutNull(final List list)
  7. maskNull(List pTypes)
  8. newListIfNull(List list)
  9. newListWhenNull(List list)