Here you can find the source of subtract(List
public static <T> List<T> subtract(List<T> aList, List<T> bList)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> subtract(List<T> aList, List<T> bList) { List<T> result = new ArrayList<T>(); for (T t : aList) { if (!bList.contains(t)) { result.add(t);//from ww w. ja v a 2 s.com } } return result; } }