@Test public void test_findPrices() { long time1 = Performance.getConsumedTime( () -> { List<String> priceTexts = Shop.findPricesSync(shops, "MacBook 11"); assertEquals(shops.size(), priceTexts.size()); }); long time2 = Performance.getConsumedTime( () -> { List<String> priceTexts = Shop.findPricesAsyncUsingParallelStream(shops, "MacBook 11"); assertEquals(shops.size(), priceTexts.size()); }); long time3 = Performance.getConsumedTime( () -> { List<String> priceTexts = Shop.findPricesAsyncUsingCompletableFuture1(shops, "MacBook 11"); assertEquals(shops.size(), priceTexts.size()); }); long time4 = Performance.getConsumedTime( () -> { List<String> priceTexts = Shop.findPricesAsyncUsingCompletableFuture(shops, "MacBook 11"); assertEquals(shops.size(), priceTexts.size()); }); System.out.println("getPrices Sync : " + time1); System.out.println("getPrices Async Parallel Stream : " + time2); System.out.println("getPrices Async Completable Future: " + time3); System.out.println("getPrices Async Completable Future with Custom Executor: " + time4); }