Open muralikk9 opened 7 years ago
BestPriceFinder.java
public Stream<CompletableFuture> findPricesStream(String product) { return shops.stream() .map(shop -> CompletableFuture.supplyAsync(() -> shop.getPrice(product), executor)) .map(future -> future.thenApply(Quote::parse)) .map(future -> future.thenCompose(quote -> CompletableFuture.supplyAsync(() -> Discount.applyDiscount(quote), executor))); }
This issue occurs on eclipse 4.6 version as mentioned here https://bugs.eclipse.org/bugs/show_bug.cgi?id=512486.. Update eclipse version or use Intellij.
BestPriceFinder.java
public Stream<CompletableFuture> findPricesStream(String product) {
return shops.stream()
.map(shop -> CompletableFuture.supplyAsync(() -> shop.getPrice(product), executor))
.map(future -> future.thenApply(Quote::parse))
.map(future -> future.thenCompose(quote -> CompletableFuture.supplyAsync(() -> Discount.applyDiscount(quote), executor)));
}