java8 stream 用法收集
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