diff --git a/src/main/java/org/akhq/repositories/RecordRepository.java b/src/main/java/org/akhq/repositories/RecordRepository.java index f9a07b6ef..4fa606594 100644 --- a/src/main/java/org/akhq/repositories/RecordRepository.java +++ b/src/main/java/org/akhq/repositories/RecordRepository.java @@ -796,12 +796,11 @@ private static boolean equalsAll(String search, Collection in) { String[] split = search.toLowerCase().split("\\s"); for (String s : in) { if(s != null) { - s = s.toLowerCase(); - for (String k : split) { - if (s.equals(k)) { - return true; - } - } + final String lowerS = s.toLowerCase(); + + return Stream.of(split) + .filter(lowerS::equals) + .count() == split.length; } } return false; @@ -817,12 +816,11 @@ private static boolean notContainsAll(String search, Collection in) { String[] split = search.toLowerCase().split("\\s"); for (String s : in) { if(s != null) { - s = s.toLowerCase(); - for (String k : split) { - if (s.contains(k)) { - return false; - } - } + final String lowerS = s.toLowerCase(); + + return Stream.of(split) + .filter(lowerS::contains) + .count() == split.length; } } return true;