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

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -