Java Set Search containsSome(Set one, Set two)

Here you can find the source of containsSome(Set one, Set two)

Description

Test if one set has overlapping membership with another set

License

Mozilla Public License

Declaration


public static boolean containsSome(Set one, Set two) 

Method Source Code

//package com.java2s;
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. 

import java.util.Iterator;
import java.util.Set;

public class Main {
    /**/*from   ww  w .jav  a  2 s .  c  om*/
     * Test if one set has overlapping membership with another set
     */

    public static boolean containsSome(Set one, Set two) {
        Iterator it = two.iterator();
        while (it.hasNext()) {
            if (one.contains(it.next())) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. contains(BitSet x, BitSet y)
  2. Contains(Set s, Object o)
  3. contains(Set setTocheck, Set mustHaveAllThese)
  4. containsAny(Set container, Set possibilities)
  5. containsCaseInsensitive(String s, Set l)