@Test public void testSet() { ArrayDeque arrayDeque = new ArrayDeque(); arrayDeque.addFirst(1); assertEquals(1, arrayDeque.get(0)); arrayDeque.set(0, 2); assertEquals(2, arrayDeque.get(0)); }
public void set(int index, E element) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException("Attempted to set " + index + " but size " + size()); } elements[(head + index) % elements.length] = element; }
ArrayDeque { public void set(int index, E element) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException("Attempted to set " + index + " but size " + size()); } elements[(head + index) % elements.length] = element; } }
ArrayDeque { public void set(int index, E element) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException("Attempted to set " + index + " but size " + size()); } elements[(head + index) % elements.length] = element; } ArrayDeque();  ArrayDeque(int width, int height);  ArrayDeque(int numElements); }
ArrayDeque { public void set(int index, E element) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException("Attempted to set " + index + " but size " + size()); } elements[(head + index) % elements.length] = element; } ArrayDeque();  ArrayDeque(int width, int height);  ArrayDeque(int numElements); void addFirst(E element); void addLast(E element); E getFirst(); E getLast(); E get(int index); void set(int index, E element); int capacity(); int size(); Object[] toArray(); }
ArrayDeque { public void set(int index, E element) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException("Attempted to set " + index + " but size " + size()); } elements[(head + index) % elements.length] = element; } ArrayDeque();  ArrayDeque(int width, int height);  ArrayDeque(int numElements); void addFirst(E element); void addLast(E element); E getFirst(); E getLast(); E get(int index); void set(int index, E element); int capacity(); int size(); Object[] toArray();  }