diff --git a/_posts/2024-03-16-JavaVersioning.md b/_posts/2024-03-16-JavaVersioning.md index 3e6b3c1..5073391 100644 --- a/_posts/2024-03-16-JavaVersioning.md +++ b/_posts/2024-03-16-JavaVersioning.md @@ -271,18 +271,23 @@ public static void main(String[] args) { ```java public static void main(String[] args) { // map() - List words = Arrays.asList("Java", "Stream", "Map"); - List upperWords = words.stream() - .map(String::toUpperCase) + List> mapList = Arrays.asList( + Arrays.asList("Java", "is"), + Arrays.asList("super", "fun") + ); + + List> mapListStreamMap = mapList.stream() + .map(List::stream) .collect(Collectors.toList()); - System.out.println(upperWords); - // 결과 : [JAVA, STREAM, MAP] + System.out.println(mapListStreamMap); + // 결과 : [java.util.stream.ReferencePipeline$Head@378bf509, java.util.stream.ReferencePipeline$Head@5fd0d5ae] // flatMap() List> listOfLists = Arrays.asList( Arrays.asList("Java", "is"), Arrays.asList("super", "fun") ); + List flatList = listOfLists.stream() .flatMap(List::stream) .collect(Collectors.toList());