ãã¦ãJava8ã§é¢æ°åã£ã½ããã¨ããã£ã¦éãã§ã¿ãããã§ãããå®éã¯ãããªæ¸ãæ¹ãã¾ããããã
Java8ã§å®éã«ä½¿ãã®ã¯ãStreamã§ãã
ã¨ãããã¨ã§ãStreamã®ä½¿ãæ¹ãã²ã¨ã¨ããè¦ã¦ã¿ã¾ãã
â»5/17 ä»æ§å¤æ´ããã£ãã®ã§ãä¿®æ£ãã¾ãã
åºæ¬
ã¾ãã¯ãIterableã¤ã³ã¿ãã§ã¼ã¹ã«ç¨æãããforEachã¡ã½ãããè¦ã¦ã¿ã¾ãããã
List<String> names = Arrays.asList("hoge hoge", "foo bar", "naoki", "kishida"); names.forEach(s -> System.out.println(s));
ããã§æ¬¡ã®ããã«è¡¨ç¤ºããã¾ãã
ãã¾ã¾ã§ã®æ¡å¼µforã ã¨æ¬¡ã®ããã«æ¸ãã¦ã¾ãã
List<String> names = Arrays.asList("hoge hoge", "foo bar", "naoki", "kishida"); for(String s : names){ System.out.println(s); }