### Question:
AkkaStreamsDemo implements ReactiveStreamsDemo { public static List<Integer> doParallelSquares() { final ActorSystem system = ActorSystem.create("parallel-squares"); final Materializer mat = ActorMaterializer.create(system); List<Integer> squares = new ArrayList<>(); Source.range(1, 64) .mapConcat(v -> Source.single(v).map(w -> w * w) .runFold(asList(), (nil, x) -> asList(x), mat).toCompletableFuture().get()) .runForeach(x -> squares.add((int) x), mat); try {Thread.sleep(300); } catch (Exception e) {} return squares; }  static List<Integer> doSquares(); static List<Integer> doParallelSquares(); static CompletionStage<ArrayList<Integer>> parallelSquares(); static Materializer createMaterializer(); @Override java.util.concurrent.Future<List<Integer>> doSquaresAsync(int count); @Override java.util.concurrent.Future<String> doStringConcatAsync(int count); @Override java.util.concurrent.Future<List<Integer>> doParallelSquaresAsync(int count); @Override java.util.concurrent.Future<String> doParallelStringConcatAsync(int count); void printErrors(); Source<String, NotUsed> getMessages(); void setChannel(Channel channel); Sink<String, CompletionStage<IOResult>> lineSink(String filename); void saveTextFile(List<String> text); Graph<SinkShape<String>, NotUsed> createFileSinkGraph(); void saveTextFileUsingGraph(List<String> text); final Collection<String> messageList; }### Answer:
@Test public void testDoParallelSquares() { List result = demo.doParallelSquares() .stream().sorted().collect(Collectors.toList()); assertArrayEquals(squares.toArray(), result.toArray()); }