java8遍历集合新方式

List list= Arrays.asList("www","eee","qqq","rrr","ttt","yyy","uuu");
list.stream().forEach(s -> System.out.println(s));

输出结果

www

eee

qqq

rrr

ttt

yyy

uuu

你可能感兴趣的:(java8遍历集合新方式)