import java.util.HashSet;
public class ContainsMethod {
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("Check 'Three' available in List : "+ss1.contains("Three"));
System.out.print("Check 'Eight' available in List : "+ss1.contains("Eight"));
}
}
No comments:
Post a Comment