[Fix] Fixed ObjectHelper.isIn() with Collection, Array

This commit is contained in:
Robert von Burg 2020-06-25 12:49:26 +02:00
parent 926fc10607
commit 1082170d02
1 changed files with 20 additions and 8 deletions

View File

@ -222,26 +222,38 @@ public class ObjectHelper {
return false; return false;
if (right instanceof Collection) { if (right instanceof Collection) {
Collection<?> collectionRight = (Collection) right;
if (left instanceof Collection) { if (left instanceof Collection) {
Collection<?> collectionRight = (Collection) right; Collection<?> collectionLeft = (Collection) left;
Collection<?> collectionleft = (Collection) left; for (Object l : collectionLeft) {
for (Object oLeft : collectionleft) { for (Object r : collectionRight) {
for (Object oRight : collectionRight) { if (equals(r, l, ignoreCase))
if (equals(oRight, oLeft, ignoreCase))
return true; return true;
} }
} }
return false; return false;
} else if (left instanceof String[]) {
String[] leftArr = (String[]) left;
for (Object r : collectionRight) {
for (Object l : leftArr) {
if (equals(r, l, ignoreCase))
return true;
}
}
return false;
} else { } else {
Collection<?> collection = (Collection) right; for (Object o : collectionRight) {
for (Object o : collection) {
if (equals(o, left, ignoreCase)) if (equals(o, left, ignoreCase))
return true; return true;
} }
return false; return false;
} }
} }
if (right instanceof Object[]) { if (right instanceof Object[]) {