Here you can find the source of addNotNull(Collection
public static void addNotNull(Collection<String> col, String toAdd)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static void addNotNull(Collection<String> col, String toAdd) { // if (toAdd != null && toAdd.length() > 0 && !col.contains("'" + toAdd.trim() + "'")) { // col.add("'" + toAdd.trim() + "'"); // }/* w w w. j a v a 2 s . co m*/ if (toAdd != null && toAdd.length() > 0 && !col.contains(toAdd.trim())) { col.add(toAdd.trim()); } } }