String (String methodName, PsiMethodCallExpression context) { final PsiExpression[] arguments = context.getArgumentList().getExpressions(); if (methodName.equals("emptyList") && arguments.length == 1 && !PsiUtil.isLanguageLevel9OrHigher(context) && ClassUtils.findClass("com.google.common.collect.ImmutableList", context) == null) { return "java.util.Collections.singletonList"; } if (methodName.equals("emptyList") || methodName.equals("singletonList")) { if (!ContainerUtil.exists(arguments, ReplaceWithArraysAsListIntention::isPossiblyNull)) { if (PsiUtil.isLanguageLevel9OrHigher(context)) { return "java.util.List.of"; } else if (ClassUtils.findClass("com.google.common.collect.ImmutableList", context) != null) { return "com.google.common.collect.ImmutableList.of"; } } return "java.util.Arrays.asList"; } if (methodName.equals("emptySet") || methodName.equals("singleton")) { if (PsiUtil.isLanguageLevel9OrHigher(context)) { return "java.util.Set.of"; } else if (ClassUtils.findClass("com.google.common.collect.ImmutableSet", context) != null) { return "com.google.common.collect.ImmutableSet.of"; } } else if (methodName.equals("emptyMap") || methodName.equals("singletonMap")) { if (PsiUtil.isLanguageLevel9OrHigher(context)) { return "java.util.Map.of"; } else if (ClassUtils.findClass("com.google.common.collect.ImmutableMap", context) != null) { return "com.google.common.collect.ImmutableMap.of"; } } return null; }