Labels { public TreeSet<Label> getLabels() { return labels; }  int len(); void add(Label label); void remove(Label label); void del(List<String> labelNames); void del(String labelName); TreeSet<Label> getLabels(); String getValue(String labelName); Labels clone(); void set(String labelName, String labelValue); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final String MetricName; static final String BUCKET_TAG; static final String BUCKET_LABEL; }
@Test public void testGetLabels() { Labels labels = new Labels(); labels.set("k1", "v1"); labels.set("k2", "v2"); labels.set("k3", "v3"); labels.set("k3", "v4"); StringBuilder sb=new StringBuilder(); labels.getLabels().stream().forEach(x->sb.append(x.toString())); System.out.println(sb.toString()); Assert.assertEquals("k1=v1k2=v2k3=v3",sb.toString()); }