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