Streamãå¤æããä¾ StreamãListã«å¤æããã«ã¯Collectors.toList()ã使ãã®ã常å¥æ段ã ããforEachã§æ¸ãã¨ä»¥ä¸ã®ããã«ãªãã import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; Stream<String> stream = Stream.of("abc", "def"); // List<String> list = stream.collect(Collectors.toList()); List<String> list = new ArrayList<>(); stream.forEach(t -> list.add(t)); System.out.println(list); âcollectã¡ã½ããã®å¼æ°ãèªä½ãã¦Listã¸å¤
{{#tags}}- {{label}}
{{/tags}}