1.迭代遍历:
Set<String> set = new HashSet<String>();
Iterator<String> iterator= set.iterator();
while (iterator.hasNext()) {
String str = it.next();
System.out.println(str);
}
2.for循环遍历:
for (String str : set) {
System.out.println(str);
}
1.迭代遍历:
Set<String> set = new HashSet<String>();
Iterator<String> iterator= set.iterator();
while (iterator.hasNext()) {
String str = it.next();
System.out.println(str);
}
2.for循环遍历:
for (String str : set) {
System.out.println(str);
}