Is a particular value in(exist) Set
import java.util.Set;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
Set<String> tSet = new TreeSet<String>();
tSet.add("1");
tSet.add("2");
tSet.add("3");
tSet.add("4");
tSet.add("5");
boolean blnExists = tSet.contains("3");
System.out.println("3 exists in TreeSet ? : " + blnExists);
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
Collection Set:
- Convert set to an Array
- Convert Set into List
- Convert a set to a synchronized Set
- Is a particular value in(exist) Set
- Iterator a set
- Maximum element of Set
- Minimum element of a Set
- Remove all elements from a set
- Remove element from Set
- Remove one set from another set
- Remove all the elements from one set to another set
- Union(Add) all the elements from one set to another set
- Intersection of one set and another set
- Set operations: union, intersection, difference
- Set operations: symmetric difference, is subset, is superset
- Size of a Set