I see it's written everywhere that flatMap flattens and map the stream but in practical for example in the below program using only flatMap we can't perform mapping operation(changing it to uppercase). We need to separately use map method here.
List<String> uppercase = Stream.of(asList("A", "B"), asList("C", "D"))
.flatMap(List::stream)
.map(String::toUpperCase)
.collect(Collectors.toList());
System.out.println(uppercase);
Is my understanding about flatMap wrong? Can anyone please help to understand this - whether flatMap only flattens the stream or it can flattens & map both? If so then how can we write code for that?