我给了pojos之类的
Customer{
List<String> groups;
}
Master{
List<String> groups;
}
我想检查像这样的条件
master1.groups.containsAny(customer1.groups);
并且
master1.groups.containsAll(customer1.groups);
我怎样才能为这两个写流口水条件?提前致谢。
我给了pojos之类的
Customer{
List<String> groups;
}
Master{
List<String> groups;
}
我想检查像这样的条件
master1.groups.containsAny(customer1.groups);
并且
master1.groups.containsAll(customer1.groups);
我怎样才能为这两个写流口水条件?提前致谢。
使用以下 Drools 函数
function boolean containsAny(List<String> sourceList, List<String> targetList){
sourceList.retainAll(targetList);
return sourceList.size() != 0;
}
function boolean containsAll(List<String> sourceList, List<String> targetList){
int size = sourceList.size();
sourceList.retainAll(targetList);
return sourceList.size() == size;
}