@Test public void testCompareTo() { final MetricName a = MetricName.EMPTY.tagged("foo", "bar"); final MetricName b = MetricName.EMPTY.tagged("foo", "baz"); assertThat(a.compareTo(b)).isLessThan(0); assertThat(b.compareTo(a)).isGreaterThan(0); assertThat(b.compareTo(b)).isEqualTo(0); assertThat(b.resolve("key").compareTo(b)).isLessThan(0); assertThat(b.compareTo(b.resolve("key"))).isGreaterThan(0); }
@Override public int compareTo(MetricName o) { if (o == null) return -1; int c = compareName(key, o.getKey()); if (c != 0) return c; return compareTags(tags, o.getTags()); }
MetricName implements Comparable<MetricName> { @Override public int compareTo(MetricName o) { if (o == null) return -1; int c = compareName(key, o.getKey()); if (c != 0) return c; return compareTags(tags, o.getTags()); } }
MetricName implements Comparable<MetricName> { @Override public int compareTo(MetricName o) { if (o == null) return -1; int c = compareName(key, o.getKey()); if (c != 0) return c; return compareTags(tags, o.getTags()); } MetricName();  MetricName(String key);  MetricName(String key, Map<String, String> tags);  MetricName(String key, MetricLevel level);  MetricName(String key, Map<String, String> tags, MetricLevel level); }
MetricName implements Comparable<MetricName> { @Override public int compareTo(MetricName o) { if (o == null) return -1; int c = compareName(key, o.getKey()); if (c != 0) return c; return compareTags(tags, o.getTags()); } MetricName();  MetricName(String key);  MetricName(String key, Map<String, String> tags);  MetricName(String key, MetricLevel level);  MetricName(String key, Map<String, String> tags, MetricLevel level); String getKey(); Map<String, String> getTags(); MetricLevel getMetricLevel(); MetricName level(MetricLevel level); MetricName resolve(String p); MetricName resolve(String p, boolean inheritTags); MetricName tagged(Map<String, String> add); MetricName tagged(String... pairs); static MetricName join(MetricName... parts); static MetricName build(String... parts); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(MetricName o); }
MetricName implements Comparable<MetricName> { @Override public int compareTo(MetricName o) { if (o == null) return -1; int c = compareName(key, o.getKey()); if (c != 0) return c; return compareTags(tags, o.getTags()); } MetricName();  MetricName(String key);  MetricName(String key, Map<String, String> tags);  MetricName(String key, MetricLevel level);  MetricName(String key, Map<String, String> tags, MetricLevel level); String getKey(); Map<String, String> getTags(); MetricLevel getMetricLevel(); MetricName level(MetricLevel level); MetricName resolve(String p); MetricName resolve(String p, boolean inheritTags); MetricName tagged(Map<String, String> add); MetricName tagged(String... pairs); static MetricName join(MetricName... parts); static MetricName build(String... parts); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(MetricName o); static final String SEPARATOR; static final Map<String, String> EMPTY_TAGS; static final MetricName EMPTY; }