Skip to content
Snippets Groups Projects
Commit 5d020260 authored by michael.ramusi's avatar michael.ramusi
Browse files

fixed bug: was retrieving wrong value

parent 132e1388
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ public class StockDatabase { ...@@ -26,7 +26,7 @@ public class StockDatabase {
private boolean isProductsAvailable(Map<Integer, Integer> productsToVerify){ private boolean isProductsAvailable(Map<Integer, Integer> productsToVerify){
return productsToVerify.keySet() return productsToVerify.keySet()
.stream() .stream()
.anyMatch(p -> productsToVerify.get(p) > getQuantity(p)); .allMatch(idProduct -> this.getQuantity(idProduct) >= productsToVerify.get(idProduct) );
} }
public double getTotalPrice(Map<Integer, Integer> productsToVerify, ProductDatabase pdb){ public double getTotalPrice(Map<Integer, Integer> productsToVerify, ProductDatabase pdb){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment