c1

java8 stream 用法收集

限于喜欢 提交于 2019-11-26 13:24:03
public class Test1 { public static void main(String[] args) { List<Integer> numbers = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9)); C1 c1 = new C1(); numbers.parallelStream().forEach(c1::method1);//操作元素 } static class C1 { public void method1(Integer integer) { System.out.print(integer + "\t"); } } } 来源: https://www.cnblogs.com/hahajava/p/11322137.html