Ejemplo n.º 1
0
 @Override
 public void remove() {
   if (!canRemove) {
     throw new IllegalStateException();
   } else {
     canRemove = false;
     list.remove(previous);
   }
 }
Ejemplo n.º 2
0
  @Override
  public E2 set(int index, E2 element) {
    E2 oldElement = get(index);

    int oldModCount = modCount;
    if (oldElement != element) {
      remove(oldElement);
      add(index, element);
    }
    // After the remove and add the modCount would have been incremented twice
    modCount = oldModCount + 1;
    return oldElement;
  }
Ejemplo n.º 3
0
 @Override
 public E2 remove(int index) {
   E2 elemToRemove = get(index);
   remove(elemToRemove);
   return elemToRemove;
 }