Here you can find the source of addIfValueNotNull(List
public static <V> boolean addIfValueNotNull(List<V> list, V value)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <V> boolean addIfValueNotNull(List<V> list, V value) { if (value == null) { return false; }//from w ww . j av a 2 s. c o m return list.add(value); } }