public Set<Product> getProductsBypriceFilter(Map<String, BigDecimal> filterParams) {
Set<Product> productsByPrice = new HashSet<>();
Set<String> criterias = filterParams.keySet();
if (criterias.contains("low")) {
for (Product product : listOfProducts) {
if (product.getUnitPrice().compareTo(filterParams.get("low"))>=0 ) {
productsByPrice.add(product);
}
}
}
return productsByPrice ;
}
I want to compare product price with "low" price from Map
but I get error
java.util.LinkedList cannot be cast to java.math.BigDecimal
Is filterParams.get("low")
a linkedlist
of one value? I can't access it like List.