PsiTypeParameter (final JavaPsiFacade facade, final PsiClass context) { PsiClass iterable = facade.findClass("java.lang.Iterable", context.getResolveScope()); if (iterable == null) return null; PsiTypeParameter[] typeParameters = iterable.getTypeParameters(); if (typeParameters.length != 1) return null; return typeParameters[0]; }