Here you can find the source of compare(List
public static List<Integer> compare(List<Integer> list1, List<Integer> list2)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { /**/*from w w w . ja v a 2 s . com*/ * Verifies that list2 contains the items of list1 and returns the list of the items from list1 that don't belong to list2 */ public static List<Integer> compare(List<Integer> list1, List<Integer> list2) { List<Integer> badList = new ArrayList<Integer>(); for (Integer i : list1) { if (!list2.contains(i)) { badList.add(i); } } return badList; } }