spring - Java Map String BigDecimal get function -
public set<product> getproductsbypricefilter(map<string, bigdecimal> filterparams) { set<product> productsbyprice = new hashset<>(); set<string> criterias = filterparams.keyset(); if (criterias.contains("low")) { (product product : listofproducts) { if (product.getunitprice().compareto(filterparams.get("low"))>=0 ) { productsbyprice.add(product); } } } return productsbyprice ; }
i want compare product price "low" price map
error
java.util.linkedlist cannot cast java.math.bigdecimal
is filterparams.get("low")
linkedlist
of 1 value? can't access list.
your product.getunitprice()
method seems returning linkedlist
object instead of bigdecimal
one. since did not supply code product.getunitprice()
hard further.
Comments
Post a Comment