0 votes
15 views

How will you print count of empty strings in Java 8?

in Education by (51.6k points)

1 Answer

0 votes

How will you print count of empty strings in Java 8?

The following code segment prints a count of empty strings using filter.

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

//get count of empty string

int count = strings.stream().filter(string -> string.isEmpty()).count();

by (51.6k points)

Related questions

0 votes
1 answer 22 views
0 votes
1 answer 8 views
0 votes
1 answer 11 views
0 votes
1 answer 8 views
0 votes
1 answer 13 views
0 votes
1 answer 17 views
0 votes
1 answer 11 views
0 votes
1 answer 13 views
0 votes
1 answer 50 views
0 votes
1 answer 14 views
0 votes
1 answer 34 views
0 votes
1 answer 14 views
0 votes
1 answer 12 views
0 votes
1 answer 12 views
0 votes
1 answer 10 views
...