@Test public void testRemoveFirst() { deque.addLast(k1); deque.addLast(k2); deque.addLast(k3); deque.removeFirst(); assertListEquals(deque.toArray(), 2, 3); assertEquals(2, deque.size()); deque.addFirst(k4); assertListEquals(deque.toArray(), 4, 2, 3); assertEquals(3, deque.size()); deque.removeFirst(); deque.removeFirst(); deque.removeFirst(); assertEquals(0, deque.toArray().length); assertEquals(0, deque.size()); }
@Override public KType removeFirst() { assert size() > 0 : "The deque is empty."; final KType result = Intrinsics.<KType> cast(buffer[head]); buffer[head] = Intrinsics.empty(); head = oneRight(head, buffer.length); return result; }
KTypeArrayDeque extends AbstractKTypeCollection<KType> implements KTypeDeque<KType>,
             Preallocable, 
             Cloneable,
             Accountable { @Override public KType removeFirst() { assert size() > 0 : "The deque is empty."; final KType result = Intrinsics.<KType> cast(buffer[head]); buffer[head] = Intrinsics.empty(); head = oneRight(head, buffer.length); return result; } }
KTypeArrayDeque extends AbstractKTypeCollection<KType> implements KTypeDeque<KType>,
             Preallocable, 
             Cloneable,
             Accountable { @Override public KType removeFirst() { assert size() > 0 : "The deque is empty."; final KType result = Intrinsics.<KType> cast(buffer[head]); buffer[head] = Intrinsics.empty(); head = oneRight(head, buffer.length); return result; } KTypeArrayDeque();  KTypeArrayDeque(int expectedElements);  KTypeArrayDeque(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayDeque(KTypeContainer<? extends KType> container); }
KTypeArrayDeque extends AbstractKTypeCollection<KType> implements KTypeDeque<KType>,
             Preallocable, 
             Cloneable,
             Accountable { @Override public KType removeFirst() { assert size() > 0 : "The deque is empty."; final KType result = Intrinsics.<KType> cast(buffer[head]); buffer[head] = Intrinsics.empty(); head = oneRight(head, buffer.length); return result; } 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); }
KTypeArrayDeque extends AbstractKTypeCollection<KType> implements KTypeDeque<KType>,
             Preallocable, 
             Cloneable,
             Accountable { @Override public KType removeFirst() { assert size() > 0 : "The deque is empty."; final KType result = Intrinsics.<KType> cast(buffer[head]); buffer[head] = Intrinsics.empty(); head = oneRight(head, buffer.length); return result; } 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; }