diff --git a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/QueryIndex.java b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/QueryIndex.java index 6b9e84acf..7ac15e396 100644 --- a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/QueryIndex.java +++ b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/QueryIndex.java @@ -94,10 +94,8 @@ private static QueryIndex empty(CacheSupplier cacheSupplier) { * This allows the {@link Id} to be traversed in order while performing the lookup. */ private static int compare(String k1, String k2) { - if ("name".equals(k1) && "name".equals(k2)) { - return 0; - } else if ("name".equals(k1)) { - return -1; + if ("name".equals(k1)) { + return "name".equals(k2) ? 0 : -1; } else if ("name".equals(k2)) { return 1; } else {