Here you can find the source of nullSafeAdd(List
public static <T> void nullSafeAdd(List<T> list, T elem)
//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*/ } } }