### Question:
KTypeArrayDeque extends AbstractKTypeCollection<KType> implements KTypeDeque<KType>,
             Preallocable, 
             Cloneable,
             Accountable { public Iterator<KTypeCursor<KType>> iterator() { return new ValueIterator(); } KTypeArrayDeque();  KTypeArrayDeque(int expectedElements);  KTypeArrayDeque(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayDeque(KTypeContainer<? extends KType> container); @Override void addFirst(KType e1); @SafeVarargs /* #end */ final void addFirst(KType... elements); int addFirst(KTypeContainer<? extends KType> container); int addFirst(Iterable<? extends KTypeCursor<? extends KType>> iterable); @Override void addLast(KType e1); @SafeVarargs /* #end */ final void addLast(KType... elements); int addLast(KTypeContainer<? extends KType> container); int addLast(Iterable<? extends KTypeCursor<? extends KType>> iterable); @Override KType removeFirst(); @Override KType removeLast(); @Override KType getFirst(); @Override KType getLast(); @Override int removeFirst(KType e1); int bufferIndexOf(KType e1); @Override int removeLast(KType e1); int lastBufferIndexOf(KType e1); @Override int removeAll(KType e1); void removeAtBufferIndex(int index); @Override boolean isEmpty(); @Override int size(); @Override void clear(); void release(); @Override void ensureCapacity(int expectedElements); @Override /*! #if ($TemplateOptions.KTypePrimitive) KType [] toArray() #else !*/ Object [] toArray(); KType[] toArray(KType[] target); @Override KTypeArrayDeque<KType> clone(); @Override long ramBytesAllocated(); @Override long ramBytesUsed(); Iterator<KTypeCursor<KType>> iterator(); Iterator<KTypeCursor<KType>> descendingIterator(); @Override T forEach(T procedure); @Override T forEach(T predicate); @Override T descendingForEach(T procedure); @Override T descendingForEach(T predicate); @Override int removeAll(KTypePredicate<? super KType> predicate); @Override boolean contains(KType e); @Override int hashCode(); @Override boolean equals(Object obj); @SafeVarargs /* #end */ static KTypeArrayDeque<KType> from(KType... elements); public Object [] buffer; public int head; public int tail; }### Answer:
@Test public void testIterator() { deque.addLast(asArray(0, 1, 2, 3)); Iterator<KTypeCursor<KType>> iterator = deque.iterator(); int count = 0; while (iterator.hasNext()) { iterator.hasNext(); iterator.hasNext(); iterator.hasNext(); iterator.next(); count++; } assertEquals(count, deque.size()); deque.clear(); assertFalse(deque.iterator().hasNext()); }