how to iterate hashset in java 8 code example
Example: how to iterate hashset in java 8
Set set = new HashSet();
for (String s : set) {
System.out.println(s);
}
//Java 8:
set.forEach(System.out::println);
Set set = new HashSet();
for (String s : set) {
System.out.println(s);
}
//Java 8:
set.forEach(System.out::println);