void (PsiPolyadicExpression expression, boolean and) { StreamEx.of(expression.getOperands()) .map(operand -> isAllowed(operand) ? operand : null) .groupRuns((o1, o2) -> o1 != null && o2 != null) .remove(list -> list.size() == 1) .forEach(operands -> process(expression, operands, and)); }