boolean (T t) { final PyClass currentClass = t instanceof PyPossibleClassMember ? ((PyPossibleClassMember)t).getContainingClass() : null; // Stop when the current class changes and there was a result if (myLastVisitedClass != null && currentClass != myLastVisitedClass && !myResult.isEmpty()) { return false; } myLastVisitedClass = currentClass; if (ArrayUtil.contains(t.getName(), myNames)) { myResult.add(t); } return true; }