コード例 #1
0
 public List<String> findPriceParallel(String product) {
   return shops
       .parallelStream()
       .map(shop -> shop.getPrice(product))
       .map(Quote::parse)
       .map(Discount::applyDiscount)
       .collect(Collectors.<String>toList());
 }
コード例 #2
0
  public List<String> findPrice(String product) {
    List<CompletableFuture<String>> priceFutures =
        findPriceStream(product).collect(Collectors.<CompletableFuture<String>>toList());

    return priceFutures.stream().map(CompletableFuture::join).collect(Collectors.<String>toList());
  }