code: public void set(Versioned<E> element) {
          if(element == null)
              throw new NullPointerException("cannot set a null element");
          if(_lastCall != LastCall.NEXT && _lastCall != LastCall.PREVIOUS)
              throw new IllegalStateException("neither next() nor previous() has been called");
  
          _stack.setById(_lastId, element);
  
          afterSet(element.getValue());
      }
docs: /*
  (non-Javadoc)
  
  @see java.util.ListIterator#set(java.lang.Object)
  
  Replaces the last element returned by next or previous with the specified
  element (optional operation). This call can be made only if neither
  ListIterator.remove nor ListIterator.add have been called after the last
  call to next or previous.