Checking whether a element present in List using mvel

Narendra picture Narendra · Jan 18, 2013 · Viewed 7.5k times · Source

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?

Answer

Mike Brock picture Mike Brock · Jan 20, 2013

This will work:

list.containsAll(["sydney", "california"])