@Test(groups = "1s", timeOut=60000) public void testGet() { CircularQueue<Integer> queue = create(); queue.addFirst(1); queue.addFirst(2); queue.addFirst(3); assertEquals(queue.get(0), Integer.valueOf(3)); assertEquals(queue.get(1), Integer.valueOf(2)); assertEquals(queue.get(2), Integer.valueOf(1)); assertEquals(queue.get(0), Integer.valueOf(3)); assertEquals(queue.get(1), Integer.valueOf(2)); assertEquals(queue.get(2), Integer.valueOf(1)); assertNull(queue.get(-1)); assertNull(queue.get(3)); }
public E get(int index) { if(index < 0 || index >= size){ return null; } return elementData[convert(index, head)]; }
CircularQueue { public E get(int index) { if(index < 0 || index >= size){ return null; } return elementData[convert(index, head)]; } }
CircularQueue { public E get(int index) { if(index < 0 || index >= size){ return null; } return elementData[convert(index, head)]; } @SuppressWarnings({"unchecked"})  CircularQueue(int size); }
CircularQueue { public E get(int index) { if(index < 0 || index >= size){ return null; } return elementData[convert(index, head)]; } @SuppressWarnings({"unchecked"})  CircularQueue(int size); boolean isEmpty(); void clear(); int size(); E get(int index); boolean addFirst(E e); boolean addLast(E e); int indexOf(E elem); E pollFirst(); E pollLast(); E remove(); E remove(int index); boolean remove(E e); }
CircularQueue { public E get(int index) { if(index < 0 || index >= size){ return null; } return elementData[convert(index, head)]; } @SuppressWarnings({"unchecked"})  CircularQueue(int size); boolean isEmpty(); void clear(); int size(); E get(int index); boolean addFirst(E e); boolean addLast(E e); int indexOf(E elem); E pollFirst(); E pollLast(); E remove(); E remove(int index); boolean remove(E e);  }