Comparator can be simplified fixes applied

GitOrigin-RevId: 00858b854d39a54acef205a12ea86be53d456aaf
This commit is contained in:
Tagir Valeev
2019-11-07 02:40:58 +00:00
committed by intellij-monorepo-bot
parent 609f358726
commit ffcd94bf94
3 changed files with 3 additions and 4 deletions
@@ -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<List<OrderRoot>> loadDependenciesToLibrary(@NotNull final Project project,
@@ -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<Map.Entry<String, Boolean>> entries = new ArrayList<>(myContextStates.entrySet());
entries.sort(Comparator.comparing(Map.Entry::getKey));
entries.sort(Map.Entry.comparingByKey());
for (Map.Entry<String, Boolean> entry : entries) {
Boolean ownValue = entry.getValue();
if (ownValue == null) {
@@ -359,7 +359,7 @@ public class ClassItemGeneratorImpl implements ClassItemGenerator {
Map<PsiMethod, String> setters = context.getSetters();
Set<Map.Entry<PsiMethod, String>> 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<PsiMethod, String> entry : entries) {
new SetterWriter(builder, psiClass, entry.getKey(), entry.getValue(), classNameProvider, context).write();