Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking whether a element present in List using mvel

Tags:

java

ognl

mvel

I had a list with me. The list is like.

List<String> locations=new ArrayList<String>();
locations.add("California");
location.add("sydney");
location.add("Egypt");

Now I want to check in mvel whether this list contains California and Sydney. I thought I could use the below one but that is giving error.

     location contains "sydney","california"

How can I find whether a list contains multiple elements in mvel?

like image 753
Narendra Avatar asked Jul 28 '26 03:07

Narendra


1 Answers

This will work:

list.containsAll(["sydney", "california"])
like image 133
Mike Brock Avatar answered Jul 29 '26 16:07

Mike Brock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!