Here you can find the source of addIfNotNull(Collection c, Object element)
public static void addIfNotNull(Collection c, Object element)
//package com.java2s; import java.util.Collection; public class Main { public static void addIfNotNull(Collection c, Object element) { if (element != null) { c.add(element);// w w w . j a va 2 s . c o m } } }