Member variable categories must have MAIN type and url.
Stream
boolean mainCatImage=categories.stream()
.anyMatch(categories -> categories.getType()
.equals("MAIN") && StringUtils.isNotBlank(categories.getUrl()));
I have rewritten the same usign MVEL. The below works, but is there any way to do it in other way with less code in MVEL?
MVEL
mainCatImage = false;
foreach (cat : input.categories) {
if(cat.type == 'MAIN' && cat.url!=empty){
mainCatImage = true;
}
}
mainCatImage;