//hashset(2种遍历方式)
Set<String> test = new HashSet<String>();
test.add("1");
test.add("2");
test.add("1");
test.add("2");
System.out.println(test.size());
Iterator<String> iter = test.iterator();
while(iter.hasNext()){
System.out.println(iter.next().toString());
}
for(String ss:test){
System.out.println(ss);
}
hashset(2种遍历方式)
最新推荐文章于 2024-09-17 08:37:20 发布