1

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;
StuartLC
  • 104,537
  • 17
  • 209
  • 285
Patan
  • 17,073
  • 36
  • 124
  • 198

0 Answers0