Java List Null Empty nullSafeAdd(List list, T elem)

Here you can find the source of nullSafeAdd(List list, T elem)

Description

null Safe Add

License

Apache License

Declaration

public static <T> void nullSafeAdd(List<T> list, T elem) 

Method Source Code

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

import java.util.List;

public class Main {
    public static <T> void nullSafeAdd(List<T> list, T elem) {
        if (list != null) {
            list.add(elem);/*from   www . j a v  a  2s.  co  m*/
        }
    }
}

Related

  1. newListIfNull(List list)
  2. newListWhenNull(List list)
  3. newListWithOneNull()
  4. nullOrEmpty(List s)
  5. nullOrEmptyList(List list)
  6. nullsafeAsList(T... elements)
  7. nullSafeList(List list)
  8. nullToEmpty(List in)
  9. nullToEmpty(List list)