import java.util.HashSet;
public class Remove {
public static void main(String[] args) {
// TODO Auto-generated method stub
HashSet<String> ss1 = new HashSet<>();
ss1.add("One");
ss1.add("Two");
ss1.add("Three");
ss1.add("Four");
ss1.add("Two");
ss1.add("Three");
ss1.add("Four");
ss1.add("Five");
System.out.println("Full-List (Duplicate Not Allowed in HashSet) : "+ss1);
System.out.println("Remove element ' Two' : "+ss1.remove("Two"));
System.out.println("After Remove Full-List : "+ss1);
}
}
No comments:
Post a Comment