Java List Contain isEitherContains(List one, List two)

Here you can find the source of isEitherContains(List one, List two)

Description

is Either Contains

License

Apache License

Declaration

public static <T> boolean isEitherContains(List<T> one, List<T> two) 

Method Source Code

//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;
    }
}

Related

  1. indexOfLineContaining(List lines, String s)
  2. isContain(List list, Integer i)
  3. isContainedInAll(String keyToSearch, List> list)
  4. isContains(final Object value, final Object... list)
  5. isContains(List roles, String role, String module)
  6. isListContainAll(List list, T... checkItems)
  7. isListContainsDuplicateElement(List oneList)
  8. pathContains(List path, String source, String label, String target)
  9. replaceWithList(List containingList, String key, List list)