import java.util.HashSet;Output:
public class HashSetremove{
public static void main(String[] args) {
HashSet< 문자열> hashset = 새로운 HashSet< 문자열> ();
hashset.add("v1");
hashset.add("v2");
hashset.add("v3");
hashset.add("v4");
hashset.add("v5");
System.out.println("제거 전 HashSet: "+hashset);
개체 e = "v2";
부울 b = hashset.remove("v2");
System.out.println("제거된 "+e+" 요소: "+b);
System.out.println(""+e+"를 제거한 후 HashSet: "+hashset);
}
}
HashSet 제거하기 전: [v1, v5, v4, v3, v2]
v2 제거된 항목: true
HashSet v2 제거 후: [v1, v5, v4, v3]
Please disable your ad blocker and refresh the window to use this website.