Java Collection Contain containsSome(HashSet s1, Collection other)

Here you can find the source of containsSome(HashSet s1, Collection other)

Description

contains Some

License

BSD License

Declaration

public static <T> boolean containsSome(HashSet<T> s1, Collection<T> other) 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.util.*;

public class Main {
    public static <T> boolean containsSome(HashSet<T> s1, Collection<T> other) {
        for (T t : other)
            if (s1.contains(t))
                return true;
        return false;
    }/*from w  w w  . jav  a2  s  .c  o m*/

    public static <T> boolean contains(T[] ts, T t) {
        for (int i = 0; i < ts.length; i++)
            if (t.equals(ts[i]))
                return true;
        return false;
    }
}

Related

  1. containsSame(Collection first, Collection second)
  2. containsSameItems(Collection col1, Collection col2)
  3. containsSameType(Object o, Collection collection)
  4. containsSome(Collection source, Collection target)
  5. containsSome(final Collection c1, final Collection c2)
  6. containsString(Collection coll, String str)
  7. containsString(String stringToCheck, Collection collection)
  8. containsStringIgnoreCase(Collection strings, String toCheck)
  9. getContainmentRelation(Collection a, Collection b)