mapStream
각 요소를 변환합니다.
문법
stream.map(mapper)예제
아래 값을 입력하면 예제에 즉시 반영됩니다.
List→String→names→of→stream→map→toUpperCase→collect→Collectors→toList→System→out→println→ALICE→BOB→CAROL→List<String> names = List.of("alice", "bob", "carol");
List<String> upper = names.stream()
.map(String::toUpperCase)
.collect(Collectors.toList());
System.out.println(upper); // [ALICE, BOB, CAROL]