Code example for TreeSet

Methods: add, first, isEmpty, remove

0
    assertEquals(0, new VersionString("3.0").compareTo(new VersionString("3")));
    assertEquals(+1, new VersionString("1.8.11").compareTo(new VersionString("1.8")));
  } 
 
  public void testSorting() throws Exception { 
    SortedSet<VersionString> set = new TreeSet<VersionString>();
    set.add(v3);
    set.add(v0);
    set.add(v1);
    set.add(v4);
    set.add(v2);
    assertEquals(v0, set.first());
    assertTrue(set.remove(v0));
    assertEquals(v1, set.first());
    assertTrue(set.remove(v1));
    assertEquals(v2, set.first());
    assertTrue(set.remove(v2));
    assertEquals(v3, set.first());
    assertTrue(set.remove(v3));
    assertEquals(v4, set.first());
    assertTrue(set.remove(v4));
    assertTrue(set.isEmpty());
  } 
 
  public void testHashing() throws Exception { 
    Map<VersionString, Integer> map = new HashMap<VersionString, Integer>();
    map.put(v3, 3);