code: protected void addToHistory(V obj)
      {
          if(maxHistory < 1)
              return;
          if(history == null)
              if (maxHistory != Integer.MAX_VALUE)//we probably set it to a reasonable value
              {
                  try
                  {
                      history = new ArrayDeque<V>(maxHistory);
                  }
                  catch (Exception ex)
                  {
                      //what is we cause one of the many OOM exceptiosn b/c initial history was too big?
                      //AKA we googed on being helpful
                      history = new ArrayDeque<V>();
                  }
              }
              else
                  history = new ArrayDeque<V>();
          if(history.size() == maxHistory)//make room
              history.removeFirst();
          history.add(obj);
      }
docs: Adds the given item to the history, creating a new history holder if
  needed. This method handles the cases where the max history is zero,
  and when the history is full (dropping the oldest)
  @param obj the object to add to the history