boolean (String line, List<String> patterns) { Set<String> lines = null; for (ConsoleLineModifier modifier : ConsoleLineModifier.EP_NAME.getExtensionList()) { String modifiedLine = modifier.modify(line); if (modifiedLine != null) { if (lines == null) { lines = new HashSet<>(); lines.add(line); } lines.add(modifiedLine); } } Condition<String> containsPredicate = l -> { for (String pattern : patterns) { if (l.contains(pattern)) { return true; } } return false; }; if (lines == null) { return containsPredicate.value(line); } return ContainerUtil.exists(lines, containsPredicate); }