直接上代码
public static void main(String[] args) {
String ss = "aa";
Integer ii = 11;
List<Supplier> supplierList = List.of(
()->ii*2,
()->ss+"hello"
);
var rlt = supplierList.parallelStream().map(x->x.get()).collect(Collectors.toList());
System.out.println((Integer)rlt.get(0));
System.out.println((String)rlt.get(1));
}
网友评论