Here you can find the source of addToList(List
public static <T> List<T> addToList(List<T> dest, T src)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> List<T> addToList(List<T> dest, T src) { if (src != null && !dest.contains(src)) { dest.add(src);//from w w w.j a v a 2 s .c o m } return dest; } }