cleanup - use Comparator

master
Egor.Ushakov 8 years ago
parent 32693c314a
commit 1d331ddd6d
  1. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java
  2. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2015 JetBrains s.r.o. * Copyright 2000-2017 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -191,7 +191,7 @@ public class DomHelper {
lstPosts.add(stt.id); lstPosts.add(stt.id);
} }
Collections.sort(lstPosts, (o1, o2) -> mapSortOrder.get(o1).compareTo(mapSortOrder.get(o2))); Collections.sort(lstPosts, Comparator.comparing(mapSortOrder::get));
if (lstPosts.size() > 1 && lstPosts.get(0).intValue() == st.id) { if (lstPosts.size() > 1 && lstPosts.get(0).intValue() == st.id) {
lstPosts.add(lstPosts.remove(0)); lstPosts.add(lstPosts.remove(0));

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2016 JetBrains s.r.o. * Copyright 2000-2017 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ public class VarProcessor {
Map<Integer, Integer> mapOriginalVarIndices = varVersions.getMapOriginalVarIndices(); Map<Integer, Integer> mapOriginalVarIndices = varVersions.getMapOriginalVarIndices();
List<VarVersionPair> listVars = new ArrayList<>(mapVarNames.keySet()); List<VarVersionPair> listVars = new ArrayList<>(mapVarNames.keySet());
Collections.sort(listVars, (o1, o2) -> o1.var - o2.var); Collections.sort(listVars, Comparator.comparingInt(o -> o.var));
Map<String, Integer> mapNames = new HashMap<>(); Map<String, Integer> mapNames = new HashMap<>();

Loading…
Cancel
Save