InterviewSolution
Saved Bookmarks
| 1. |
Write a program to print count of empty strings in java 8? |
|
Answer» The code to print the COUNT of empty strings in Java 8 is:- List strings = Arrays.asList("abc", "", "bc", "EFG", "abcd","", "jkl"); POINT to be NOTED: Go through this Q&A very thoroughly as this is ONE of the most asked java 8 interview questions. Example List<String>strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl"); int count = strings.stream().filter(string −> string.isEmpty()).count(); |
|