TagSet implements Iterable<Tag> { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(tags.values()); return builder.toString(); } TagSet(TreeMap<String, Tag> tags); @Override Iterator<Tag> iterator(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testTostring() { TagSet raw = new TagSet(new TreeMap<String, Tag>()); TagSet tagSet1 = raw.add("k1", "v1"); tagSet1 = tagSet1.addAll(new String[] { "k2", "v2", "k1", "v3" }); System.out.println(tagSet1.toString()); Assert.assertTrue(tagSet1.toString().contains("k1=v3")); }