Java Set Search Contains(Set s, Object o)

Here you can find the source of Contains(Set s, Object o)

Description

Contains

License

Open Source License

Declaration

public static boolean Contains(Set s, Object o) 

Method Source Code

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

import java.util.Set;

import java.util.Iterator;

public class Main {
    public static boolean Contains(Set s, Object o) {
        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;
                }//  www.j  a va  2 s  .  c  om
            }
            return false;
        }
        return true;
    }
}

Related

  1. contains(BitSet x, BitSet y)
  2. contains(Set setTocheck, Set mustHaveAllThese)
  3. containsAny(Set container, Set possibilities)
  4. containsCaseInsensitive(String s, Set l)
  5. containsSome(Set one, Set two)