1Stream.of("cat", "dog", "elephant", "fox", "rabbit", "duck")
2 .takeWhile(n -> n.length() % 2 != 0)
3 .forEach(System.out::println);
4
5//sysout -> cat
6//sysout -> dog
7
8//Same code, no streams
9
10List<String> list = asList("cat", "dog", "elephant", "fox", "rabbit", "duck");
11for (int i = 0; i < list.size(); i++) {
12 String item = list.get(i);
13 if (item.length() % 2 == 0) {
14 break;
15 }
16 System.out.println(item);
17}
1for(String str : strArr) {
2 continue; //Skips current iteration and moves onto the following
3}