diff --git a/src/main/java/com/reandroid/dex/pool/KeyItemGroup.java b/src/main/java/com/reandroid/dex/pool/KeyItemGroup.java index 729b6a86c..d30a4e036 100644 --- a/src/main/java/com/reandroid/dex/pool/KeyItemGroup.java +++ b/src/main/java/com/reandroid/dex/pool/KeyItemGroup.java @@ -25,7 +25,7 @@ import java.util.*; -public class KeyItemGroup extends ArrayCollection implements ArraySupplier, Comparator { +public class KeyItemGroup extends ArrayCollection implements ArraySupplier { private boolean sorted; @@ -75,28 +75,25 @@ private void sort(){ if(size < 2){ return; } - super.sort(this); + super.sort((item1, item2) -> { + if(item1 == item2){ + return 0; + } + if(item1 == null){ + return -1; + } + if(item2 == null){ + return 1; + } + int i = CompareUtil.compare(((KeyItem)item1).getKey(), ((KeyItem)item2).getKey()); + if(i != 0){ + return i; + } + return Integer.compare(item1.getIndex(), item2.getIndex()); + }); sorted = true; } - @Override - public int compare(T item1, T item2) { - if(item1 == item2){ - return 0; - } - if(item1 == null){ - return -1; - } - if(item2 == null){ - return 1; - } - int i = CompareUtil.compare(((KeyItem)item1).getKey(), ((KeyItem)item2).getKey()); - if(i != 0){ - return i; - } - return Integer.compare(item1.getIndex(), item2.getIndex()); - } - @Override public boolean equals(Object obj) { if(obj == this){