Add values to HashSet : HashSet « Collections Data Structure « Java
- Java
- Collections Data Structure
- HashSet
Add values to HashSet
import java.util.HashSet;
class HashSetDemo {
public static void main(String args[]) {
HashSet<String> hs = new HashSet<String>();
hs.add("B");
hs.add("A");
hs.add("D");
hs.add("E");
hs.add("C");
hs.add("F");
System.out.println(hs);
}
}
Related examples in the same category