#23 Transforming a Collection into a Map with the Stream API

Companies:
Sberbank
Themes:
JavaStreams & LambdasPractice

The following collection is given

var strList = List.of(
    "CString1", "bString2", "CString3", "CString4", "bString5"
);

Using the Stream API:

  • Convert the strings to uppercase.
  • Create a map where the key is the first character of the string and the value is the strings.

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