boolean (PsiExpression retValue, List<? super Pair<PsiExpression, Boolean>> iterableReturnValues, PsiClass iterable, PsiClass collection) { if (retValue == null) return false; PsiType type = retValue.getType(); if (PsiTypes.nullType().equals(type)) { return true; } if (type instanceof PsiCapturedWildcardType) { type = ((PsiCapturedWildcardType)type).getUpperBound(); } if (type instanceof PsiClassType) { final PsiClass resolvedClass = ((PsiClassType)type).resolve(); if (InheritanceUtil.isInheritorOrSelf(resolvedClass, iterable, true)) { final boolean isCollection = InheritanceUtil.isInheritorOrSelf(resolvedClass, collection, true); iterableReturnValues.add(Pair.create(retValue, isCollection)); return true; } } return false; }