CircularList { public boolean remove(E element) { boolean contained = _elements.remove(element); if (_currentPos == size()) _currentPos = 0; return contained; } CircularList(int initialCapacity);  CircularList();  CircularList(List<E> list);  CircularList(Collection<E> list); void add(E element); E getTop(); E getTail(); E getNext(); void moveToEnd(); void moveToMid(); E removeTop(); boolean remove(E element); int size(); boolean isEmpty(); @Override String toString(); List<E> asList();  }
@Test public void testRemove() { CircularList<Integer> list = new CircularList<Integer>(); int valueCount = 10; for (int i = 0; i < valueCount; i++) { list.add(new Integer(i)); } assertEquals(new Integer(valueCount - 1), list.getTop()); list.remove(new Integer(valueCount - 1)); assertEquals(new Integer(valueCount - 2), list.getTop()); list.remove(new Integer(valueCount - 4)); assertEquals(new Integer(valueCount - 2), list.getNext()); assertEquals(new Integer(valueCount - 3), list.getNext()); assertEquals(new Integer(valueCount - 5), list.getNext()); assertEquals(valueCount - 2, list.size()); assertEquals(new Integer(valueCount - 6), list.removeTop()); assertEquals(new Integer(valueCount - 7), list.getTop()); list.moveToEnd(); list.moveToMid(); while (list.size() > 0) { list.remove(list.getTop()); } list.remove(000); }