@Test public void testIterator() { Iterator<String> ite = seq.iterator(); assertFalse("Empty sequence iterator not empty", ite.hasNext()); seq.append("a"); seq.append("b"); seq.append("c"); Iterator<String> it = seq.iterator(); assertTrue("Iterator over data thinks it is empty", it.hasNext()); assertEquals("Iterator did not return correct element at first", "a", it.next()); assertEquals("Iterator did not return correct second element", "b", it.next()); assertEquals("Iterator did not return correct third element", "c", it.next()); assertFalse("Iterator should not have anything left, but think it does", it.hasNext()); assertEquals("Original sequence length modified after iterator", 3 , seq.length()); }
@Override public Iterator<T> iterator() { SequenceIterator<T> iterator = new SequenceIterator<T>(this); return iterator; }
CircularArraySequence implements Sequence { @Override public Iterator<T> iterator() { SequenceIterator<T> iterator = new SequenceIterator<T>(this); return iterator; } }
CircularArraySequence implements Sequence { @Override public Iterator<T> iterator() { SequenceIterator<T> iterator = new SequenceIterator<T>(this); return iterator; } CircularArraySequence(int size);  CircularArraySequence(CircularArraySequence<T> seq); }
CircularArraySequence implements Sequence { @Override public Iterator<T> iterator() { SequenceIterator<T> iterator = new SequenceIterator<T>(this); return iterator; } CircularArraySequence(int size);  CircularArraySequence(CircularArraySequence<T> seq); @Override Object head(); @Override Object last(); @Override Sequence front(); @Override Sequence tail(); @Override Sequence<T> concat(Sequence seq); @Override boolean contains(Sequence subseq); @Override boolean contains(Object element); @Override void append(Object element); @Override void prepend(Object element); @Override boolean isEmpty(); @Override Object peekHead(); @Override Object peekLast(); @Override boolean equals(Sequence seq); @Override int length(); @Override Iterator<T> iterator(); String toString(); }
CircularArraySequence implements Sequence { @Override public Iterator<T> iterator() { SequenceIterator<T> iterator = new SequenceIterator<T>(this); return iterator; } CircularArraySequence(int size);  CircularArraySequence(CircularArraySequence<T> seq); @Override Object head(); @Override Object last(); @Override Sequence front(); @Override Sequence tail(); @Override Sequence<T> concat(Sequence seq); @Override boolean contains(Sequence subseq); @Override boolean contains(Object element); @Override void append(Object element); @Override void prepend(Object element); @Override boolean isEmpty(); @Override Object peekHead(); @Override Object peekLast(); @Override boolean equals(Sequence seq); @Override int length(); @Override Iterator<T> iterator(); String toString();  }