The code to print count of empty strings in Java 8 is:-

List strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl");

//get a count of empty string

long count = strings.p

arallelStream().filter(string -> string.isEmpty()).count();

Point to be noted: Go through this Q&A very thoroughly as this is one of the most

asked java 8 interview questions.


List<String>strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl");
int count = −> string.isEmpty()).count();

Suggest An Answer

No suggestions avaliable!