Consider the below

List<String> lstNames = new ArrayList<String>();
lstNames.add("Name1");
lstNames.add("Name2");
lstNames.add("Name3");
lstNames.add("Name4");
lstNames.add("Name5");
Stream<String> stream = lstNamesstream();

Which method in Java 1.8 will help to convert a Stream to Collection?

 Posted by Rajnilari2015 on 9/19/2015 | Category: Others Interview questions | Views: 623 | Points: 40
Select from following answers:
  1. stream.toList()
  2. stream.getCollection()
  3. stream.Collectors.toList()
  4. stream.collect(Collectors.toList())
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response