PsiType (@NotNull List<BuilderInfo> builderInfos, PsiClass builderPsiClass, PsiClass psiClass) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiClass.getProject()); final PsiType[] psiTypes = builderInfos.stream() .map(BuilderInfo::getObtainViaFieldVariableType) .filter(Optional::isPresent) .map(Optional::get) .toArray(PsiType[]::new); return factory.createType(builderPsiClass, psiTypes); }