public boolean addState(State s) {
    if (s.rngState == -1)
      throw new IllegalArgumentException("Tried to add state "+s+" without rngState.");

    if(!stateMap.containsKey(s.stepCount))
      stateMap.put(s.stepCount, useList ? new SubMapList() : new SubMapMap());
    SubMap subMap = stateMap.get(s.stepCount);

    if(!subMap.add(s))
      return false;
    prune();
    return true;
  }