Code example for ListIterator

Methods: nextIndex, set

0
 
      @Override 
      public void set(T e) {
         checkForComodification(); 
         incModCount(); 
         int index = itr.nextIndex() - 1;
         G obj = cmd.instantiateAndAdd(index, e, target);
         CompoundElmt<T, G> cpd = new CompoundElmt<T, G>(cmd, new Integer(index), obj);
         CompoundElmt<T, G> old = current;
         if (old.key != index) {
            throw new IllegalStateException(LOC.get("INTERNAL_INCONSISTENCY").getMessage());
         } 
         cmd.remove(old.genuine, target);
         itr.set(cpd);
      } 
   } 
} 
 
class Shifter { 
 
   protected void shiftInc(int index, int inc) {