groovy - How to find in a collection? -
i have following variable , collection
def currentproduct = "item1" def currentpresentation = "crema" def curentmeasure = "1ml" def items = [[product:"item1", presentation:"crema", measure:"1ml", quantity:5, total:77.50], [product:"item1", presentation:"spray", measure:"habracadabra", quantity:9, total:158.40]]
i need quantity value in map product, presentation , measure equal variable values, can me
thanks time
here go:
items.find { it.product == currentproduct && it.presentation == currentpresentation && it.measure == curentmeasure}?.quantity
Comments
Post a Comment