List<PsiType> (PsiType @NotNull [] types, @NotNull PsiType defaultType) { Map<String, PsiType> map = new LinkedHashMap<>(); String defaultTypeKey = serialize(defaultType); map.put(defaultTypeKey, defaultType); Arrays.stream(types).forEach(t -> map.put(serialize(t), t)); List<PsiType> ordered = new ArrayList<>(); StatisticsManager statisticsManager = StatisticsManager.getInstance(); String statsKey = "IntroduceVariable##" + defaultTypeKey; for (StatisticsInfo info : statisticsManager.getAllValues(statsKey)) { String typeKey = info.getValue(); PsiType type = map.get(typeKey); if (type != null) { map.remove(typeKey); ordered.add(type); } } ordered.addAll(map.values()); return ordered; }