What is the result?

Given the code fragment:
List<String> empDetails = Arrays.asList(“100, Robin, HR”,
“200, Mary, AdminServices”,
“101, Peter, HR”);
empDetails.stream()
.filter(s-> s.contains(“1”))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

Given the code fragment:
List<String> empDetails = Arrays.asList(“100, Robin, HR”,
“200, Mary, AdminServices”,
“101, Peter, HR”);
empDetails.stream()
.filter(s-> s.contains(“1”))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

A.
100, Robin, HR
101, Peter, HR

B.
A compilation error occurs at line n1.

C.
100, Robin, HR
101, Peter, HR
200, Mary, AdminServices

D.
100, Robin, HR
200, Mary, AdminServices
101, Peter, HR



Leave a Reply 3

Your email address will not be published. Required fields are marked *


smh

smh

A.
100, Robin, HR
101, Peter, HR