PyCollectionType (@NotNull PsiElement anchor, @Nullable PyType valueType) { final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(anchor); return Optional .ofNullable(builtinCache.getDictType()) .map(PyClassType::getPyClass) .map(dictClass -> new PyCollectionTypeImpl(dictClass, false, Arrays.asList(builtinCache.getStrType(), valueType))) .orElse(null); }