diff --git a/server/src/main/java/io/druid/client/selector/CustomTierSelectorStrategy.java b/server/src/main/java/io/druid/client/selector/CustomTierSelectorStrategy.java index 755319905a4..9f75302e872 100644 --- a/server/src/main/java/io/druid/client/selector/CustomTierSelectorStrategy.java +++ b/server/src/main/java/io/druid/client/selector/CustomTierSelectorStrategy.java @@ -22,7 +22,6 @@ package io.druid.client.selector; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonCreator; import com.google.common.collect.Maps; -import com.google.common.primitives.Ints; import java.util.Comparator; import java.util.Map; @@ -48,16 +47,7 @@ public class CustomTierSelectorStrategy extends AbstractTierSelectorStrategy pos++; } - this.comparator = new Comparator() - { - @Override - public int compare(Integer o1, Integer o2) - { - int pos1 = lookup.get(o1); - int pos2 = lookup.get(o2); - return Ints.compare(pos1, pos2); - } - }; + this.comparator = Comparator.comparingInt(lookup::get); } @Override diff --git a/server/src/main/java/io/druid/client/selector/HighestPriorityTierSelectorStrategy.java b/server/src/main/java/io/druid/client/selector/HighestPriorityTierSelectorStrategy.java index 33443555668..0598994b0ce 100644 --- a/server/src/main/java/io/druid/client/selector/HighestPriorityTierSelectorStrategy.java +++ b/server/src/main/java/io/druid/client/selector/HighestPriorityTierSelectorStrategy.java @@ -21,7 +21,6 @@ package io.druid.client.selector; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonCreator; -import com.google.common.primitives.Ints; import java.util.Comparator; @@ -29,15 +28,6 @@ import java.util.Comparator; */ public class HighestPriorityTierSelectorStrategy extends AbstractTierSelectorStrategy { - private static final Comparator comparator = new Comparator() - { - @Override - public int compare(Integer o1, Integer o2) - { - return Ints.compare(o2, o1); - } - }; - @JsonCreator public HighestPriorityTierSelectorStrategy(@JacksonInject ServerSelectorStrategy serverSelectorStrategy) { @@ -47,6 +37,6 @@ public class HighestPriorityTierSelectorStrategy extends AbstractTierSelectorStr @Override public Comparator getComparator() { - return comparator; + return Comparator.reverseOrder(); } } diff --git a/server/src/main/java/io/druid/client/selector/LowestPriorityTierSelectorStrategy.java b/server/src/main/java/io/druid/client/selector/LowestPriorityTierSelectorStrategy.java index a939ee0ed7e..901f059c4a2 100644 --- a/server/src/main/java/io/druid/client/selector/LowestPriorityTierSelectorStrategy.java +++ b/server/src/main/java/io/druid/client/selector/LowestPriorityTierSelectorStrategy.java @@ -21,7 +21,6 @@ package io.druid.client.selector; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonCreator; -import com.google.common.primitives.Ints; import java.util.Comparator; @@ -29,15 +28,6 @@ import java.util.Comparator; */ public class LowestPriorityTierSelectorStrategy extends AbstractTierSelectorStrategy { - private static final Comparator comparator = new Comparator() - { - @Override - public int compare(Integer o1, Integer o2) - { - return Ints.compare(o1, o2); - } - }; - @JsonCreator public LowestPriorityTierSelectorStrategy(@JacksonInject ServerSelectorStrategy serverSelectorStrategy) { @@ -47,6 +37,6 @@ public class LowestPriorityTierSelectorStrategy extends AbstractTierSelectorStra @Override public Comparator getComparator() { - return comparator; + return Comparator.naturalOrder(); } }