Answers for "set for each java"

2

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);
Posted by: Guest on March-18-2020
0

java set foreach

Set<String> set = new HashSet<String>();

//populate set

for (String s : set) {
    System.out.println(s);
}
Posted by: Guest on February-02-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language