Code example for TreeSet

Methods: additerator

0
        ConsoleVersion version122 = new ConsoleVersion("1.2.2");
        ConsoleVersion version200 = new ConsoleVersion("2.0.0");
        ConsoleVersion version201 = new ConsoleVersion("2.0.1");
        ConsoleVersion version210 = new ConsoleVersion("2.1.0");
 
        TreeSet<ConsoleVersion> set = new TreeSet<ConsoleVersion>();
        set.add(versionMain);
        set.add(version001);
        set.add(version002);
        set.add(version010);
        set.add(version020);
        set.add(version100);
        set.add(version101);
        set.add(version102);
        set.add(version110);
        set.add(version111);
        set.add(version120);
        set.add(version122);
        set.add(version200);
        set.add(version201);
        set.add(version210);
 
        Iterator<ConsoleVersion> it = set.iterator();
        Assert.assertEquals(version210, it.next());
        Assert.assertEquals(version201, it.next());
        Assert.assertEquals(version200, it.next());
        Assert.assertEquals(version122, it.next());
        Assert.assertEquals(version120, it.next());