public Iterator<Long> iterator() {
        return new SequenceIterator();
    }
@Test
    public void testIterator() {
        SequenceSet set = new SequenceSet();
        set.add(new Sequence(0, 2));
        set.add(new Sequence(4, 5));
        set.add(new Sequence(7));
        set.add(new Sequence(20, 21));

        long expected[] = new long[]{0, 1, 2, 4, 5, 7, 20, 21};
        int index = 0;

        Iterator<Long> iterator = set.iterator();
        while(iterator.hasNext()) {
            assertEquals(expected[index++], iterator.next().longValue());
        }
    }