From ffcd94bf948cbef7704e0705a5e8d076c8b0f8e2 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Wed, 30 Oct 2019 16:47:39 +0700 Subject: [PATCH] Comparator can be simplified fixes applied GitOrigin-RevId: 00858b854d39a54acef205a12ea86be53d456aaf --- .../jetbrains/idea/maven/utils/library/RepositoryUtils.java | 2 +- .../intellij/codeInsight/template/impl/TemplateContext.java | 3 +-- .../refactoring/convertToJava/ClassItemGeneratorImpl.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/java/idea-ui/src/org/jetbrains/idea/maven/utils/library/RepositoryUtils.java b/java/idea-ui/src/org/jetbrains/idea/maven/utils/library/RepositoryUtils.java index e93ee21d9dce..f47dc399e683 100644 --- a/java/idea-ui/src/org/jetbrains/idea/maven/utils/library/RepositoryUtils.java +++ b/java/idea-ui/src/org/jetbrains/idea/maven/utils/library/RepositoryUtils.java @@ -75,7 +75,7 @@ public class RepositoryUtils { final Integer count = counts.get(root); counts.put(root, count != null ? count + 1 : 1); } - return Collections.max(counts.entrySet(), Comparator.comparing(Map.Entry::getValue)).getKey(); + return Collections.max(counts.entrySet(), Map.Entry.comparingByValue()).getKey(); } public static Promise> loadDependenciesToLibrary(@NotNull final Project project, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateContext.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateContext.java index e4f88408581f..a166ba4030a2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateContext.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateContext.java @@ -20,7 +20,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; @@ -158,7 +157,7 @@ public class TemplateContext { Element element = new Element(TemplateSettings.CONTEXT); List> entries = new ArrayList<>(myContextStates.entrySet()); - entries.sort(Comparator.comparing(Map.Entry::getKey)); + entries.sort(Map.Entry.comparingByKey()); for (Map.Entry entry : entries) { Boolean ownValue = entry.getValue(); if (ownValue == null) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java index 5ed2d9ef60e9..acc9ed647e94 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java @@ -359,7 +359,7 @@ public class ClassItemGeneratorImpl implements ClassItemGenerator { Map setters = context.getSetters(); Set> entries = setters.entrySet(); if (ApplicationManager.getApplication().isUnitTestMode()) { - entries = ImmutableSortedSet.copyOf(Comparator.comparing(Map.Entry::getValue), entries); + entries = ImmutableSortedSet.copyOf(Map.Entry.comparingByValue(), entries); } for (Map.Entry entry : entries) { new SetterWriter(builder, psiClass, entry.getKey(), entry.getValue(), classNameProvider, context).write();