SET

Set Collection in Java

Here we will learn about what is “Set Interface” and when we should use it . I usually use sets, when...

Methods in HashSet in Java

Methods in HashSet in Java

—MethodsHashSet.java— import java.util.HashSet; import java.util.Iterator; public class MethodsHashSet { public static void main(String args[]) { HashSet hs=new HashSet(); { hs.add("a");...

TreeSet in Java

TreeSet in Java

In TreeSet binary tree is used. Duplicate cannot be inserted in the tree. TreeSet implements SortedSet that means ordering is...

HastSet in Java

HastSet in Java

—MyHashSet.java— import java.util.HashSet; import java.util.Iterator; public class MyHashSet { public static void main(String args[]) { HashSet hs=new HashSet(); { hs.add("a");...