#326 Processing a List of Strings with Stream API

Companies:
IgaTech
Themes:
JavaStreams & LambdasCode Review

What is the result?

List<String> l = new LinkedList<>();
l.add("first");
l.add("second");
l.add("last");

Stream<String> s0 = l.stream();
Stream<String> s1 = s0.filter(Objects::nonNull);
Stream<String> s2 = s1.map(String::toUpperCase);
List<String> result = s2.collect(Collectors.toList());

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in