in Education by

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

1 Answer

0 votes
by

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

//get count of empty string

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

//It is very easy to switch between sequential and parallel streams.

Related questions

0 votes
    Liststrings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl");...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How is Arrays.asList() different than the standard way of initialising List? (a) Both are same (b) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    How is Arrays.asList() different than the standard way of initialising List? (a) Both are same (b) ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    I have a given list of string and a list of characters and I want to check the string with ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    I tried to convert data from the list of strings into a Map with the Stream API. But the way I ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 3, 2022 in Education by JackTerrance
0 votes
    What would be your preferred way to concatenate strings from a sequence such that between every two consecutive ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?...
asked Nov 23, 2020 in Technology by JackTerrance
0 votes
    What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?...
asked Nov 23, 2020 in Technology by JackTerrance
0 votes
    What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?...
asked Nov 23, 2020 in Technology by JackTerrance
0 votes
    What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?...
asked Nov 23, 2020 in Technology by JackTerrance
...