Here you can find the source of getLeftDiff(List
public static <T> List<T> getLeftDiff(List<T> list1, List<T> list2)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> List<T> getLeftDiff(List<T> list1, List<T> list2) { if (isEmpty(list2)) { return list1; }/*from w ww. j a v a2s .c o m*/ List<T> list = new ArrayList<T>(); if (isNotEmpty(list1)) { for (T o : list1) { if (!list2.contains(o)) { list.add(o); } } } return list; } public static boolean isEmpty(Map<?, ?> map) { return !isNotEmpty(map); } public static boolean isEmpty(Collection<?> collection) { return !isNotEmpty(collection); } public static boolean isNotEmpty(Map<?, ?> map) { return map != null && map.size() > 0; } public static boolean isNotEmpty(Collection<?> collection) { return collection != null && collection.size() > 0; } }