Java Utililty Methods Set Search

List of utility methods to do Set Search

Description

The list of methods to do Set Search are organized into topic(s).

Method

booleancontains(BitSet x, BitSet y)
Returns true if all bits set in the second parameter are also set in the first
BitSet tmp = new BitSet();
tmp.or(y);
tmp.andNot(x);
return tmp.isEmpty();
booleanContains(Set s, Object o)
Contains
if (!s.contains(o)) {
    if (o instanceof Number) {
        double val = ((Number) o).doubleValue();
        for (Iterator it = s.iterator(); it.hasNext();) {
            Object e = it.next();
            if (e instanceof Number)
                if (val == ((Number) e).doubleValue())
                    return true;
...
booleancontains(Set setTocheck, Set mustHaveAllThese)
contains
for (String s : mustHaveAllThese) {
    if (!setTocheck.contains(s)) {
        return false;
return true;
booleancontainsAny(Set container, Set possibilities)
contains Any
boolean result = false;
Iterator<T> possibilitiesIter = possibilities.iterator();
while (!result && possibilitiesIter.hasNext()) {
    result = container.contains(possibilitiesIter.next());
return result;
booleancontainsCaseInsensitive(String s, Set l)
contains Case Insensitive
for (String string : l) {
    if (string.equalsIgnoreCase(s)) {
        return true;
return false;
booleancontainsSome(Set one, Set two)
Test if one set has overlapping membership with another set
Iterator it = two.iterator();
while (it.hasNext()) {
    if (one.contains(it.next())) {
        return true;
return false;