Here you can find the source of difference(List
public static <T> List<T> difference(List<T> set1, List<T> set2)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> difference(List<T> set1, List<T> set2) { List<T> diff = new ArrayList<T>(set1); diff.removeAll(set2);//from ww w . j av a2s .c o m return diff; } }