Option B doesn't seem right because the map() method is used to transform the elements, not to filter them. The count() method would return the number of elements that are true, which is not what we want.
I think option A is the correct answer. The stream() method is used to create a stream of the list elements, and the filter() method is used to filter the elements based on the condition x.length() > 3, which gives us the count of the string elements whose length is greater than three.
I think the answer is A) listVal.stream().filter(x -> x.length()>3).count(). Because it filters out the elements with length greater than three and then counts them.
upvoted 0 times
...
Log in to Pass4Success
Sign in:
Report Comment
Is the comment made by USERNAME spam or abusive?
Commenting
In order to participate in the comments you need to be logged-in.
You can sign-up or
login
Shenika
6 days agoJanine
16 days agoVenita
16 days agoElliott
17 days agoRessie
18 days ago