ArrayList<PsiType> (final ArrayList<? extends PsiType> typeList) { ArrayList<PsiType> result = new ArrayList<>(); TypeListCreatingVisitor visitor = new TypeListCreatingVisitor(result, myFactory); for (PsiType psiType : typeList) { visitor.visitType(psiType); } final PsiType defaultType = getDefaultType(); for (int index = 0; index < result.size(); index++) { PsiType psiType = result.get(index); if (psiType.equals(defaultType)) { result.remove(index); break; } } final PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(defaultType); if (unboxedType != null) { result.remove(unboxedType); result.add(0, unboxedType); } if (defaultType instanceof PsiPrimitiveType && myMainOccurrence != null) { final PsiClassType boxedType = ((PsiPrimitiveType)defaultType).getBoxedType(myMainOccurrence); if (boxedType != null) { result.remove(boxedType); result.add(0, boxedType); } } if (!TypeConversionUtil.isComposite(defaultType)) { result.add(0, defaultType); } return result; }