Here you can find the source of isEitherContains(List
public static <T> boolean isEitherContains(List<T> one, List<T> two)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> boolean isEitherContains(List<T> one, List<T> two) { if (!isAllNotNull(one, two)) return true; List<T> longer = one.size() > two.size() ? one : two; List<T> shorter = one.size() > two.size() ? two : one; boolean contains = true; for (T t : shorter) { if (!longer.contains(t)) { contains = false;// w w w . jav a2s. co m break; } } return contains; } public static <T> boolean isAllNotNull(T one, T two) { return one != null && two != null; } }