@Test(groups = "1s", timeOut=60000) public void testIndexOf() { CircularQueue<Integer> queue = create(); queue.addFirst(1); queue.addFirst(2); queue.addFirst(3); assertEquals(queue.indexOf(1), 2); assertEquals(queue.indexOf(2), 1); assertEquals(queue.indexOf(3), 0); assertEquals(queue.indexOf(4), -1); }
public int indexOf(E elem) { assert elem != null; for (int i = 0; i < size; i++) if (elem.equals(elementData[convert(head, i)])) return i; return -1; }
CircularQueue { public int indexOf(E elem) { assert elem != null; for (int i = 0; i < size; i++) if (elem.equals(elementData[convert(head, i)])) return i; return -1; } }
CircularQueue { public int indexOf(E elem) { assert elem != null; for (int i = 0; i < size; i++) if (elem.equals(elementData[convert(head, i)])) return i; return -1; } @SuppressWarnings({"unchecked"})  CircularQueue(int size); }
CircularQueue { public int indexOf(E elem) { assert elem != null; for (int i = 0; i < size; i++) if (elem.equals(elementData[convert(head, i)])) return i; return -1; } @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 int indexOf(E elem) { assert elem != null; for (int i = 0; i < size; i++) if (elem.equals(elementData[convert(head, i)])) return i; return -1; } @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);  }