Here you can find the source of addIfNotNull(final Collection
static <V> boolean addIfNotNull(final Collection<V> collection, final V value)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { static <V> boolean addIfNotNull(final Collection<V> collection, final V value) { if (value == null) { return false; } else {/*from ww w. j a v a 2s. c om*/ return collection.add(value); } } }