]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
AsyncUtils.pmap() to use Collectors.toList() 73/2473/1
authorjsimomaa <jani.simomaa@gmail.com>
Tue, 20 Nov 2018 08:34:56 +0000 (10:34 +0200)
committerjsimomaa <jani.simomaa@gmail.com>
Tue, 20 Nov 2018 08:34:56 +0000 (10:34 +0200)
gitlab #207

Change-Id: I17ceafa27e6d27c7159c1698910d14b341476e1e

bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/utils/AsyncUtils.java

index fcab99c20ae632f4b26320bdafecf66fbd46334b..d771a821e8e65329134ebd8af37af7779b21866a 100644 (file)
@@ -2,7 +2,6 @@ package org.simantics.scl.runtime.utils;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -55,7 +54,7 @@ public class AsyncUtils {
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     public static List<Object> pmap(Function f, List<Object> l) {
-        return Arrays.asList(l.parallelStream().map(a -> f.apply(a)).toArray());
+        return l.parallelStream().map(f::apply).collect(Collectors.toList());
     }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })