Code example for Vector

Methods: add, setSize

0
     * getPrevious() removes all the future history (elements with positions >= current history 
     * position). 
     *  
     */ 
    private void add(EditItem item) {
      mmHistory.setSize(mmPosition);
      mmHistory.add(item);
      mmPosition++;
    } 
 
    /** 
     * Traverses the history backward by one position, returns and item at that position. 
     */ 
    private EditItem getPrevious() { 
      if (mmPosition == 0) {
        return null; 
      } 
      mmPosition--;
      return mmHistory.get(mmPosition);
    }