Java List Contain containsOneEqualElem(List first, List second)

Here you can find the source of containsOneEqualElem(List first, List second)

Description

Test of a list contains one or more equal elements

License

Open Source License

Parameter

Parameter Description
first first list
second second list to compare

Return

true if one or more elements are the same, false if lists are completely different

Declaration

public static boolean containsOneEqualElem(List first, List second) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**//  w  ww .  j  a va2s.  c om
     * Test of a list contains one or more equal elements
     *
     * @param first  first list
     * @param second second list to compare
     *
     * @return true if one or more elements are the same, false if lists are completely different
     */
    public static boolean containsOneEqualElem(List first, List second) {
        for (Object str : first) {
            if (second.contains(str))
                return true;
        }
        return false;
    }
}

Related

  1. containsInstance(List list, Object object)
  2. containsItems(List smallerList, List largerList)
  3. containsNonPositives(List vals)
  4. containsNull(List list)
  5. containsNullElement(List source)
  6. containsOnly(List elements, Class clazz)
  7. containsOnlyEmptyValues(List list)
  8. containsOnlyNulls(List list)
  9. containsOnlySequentialNumbers(List values)