code: @NonNull public <T> T peek(int index) {
      //noinspection unchecked
      return (T) history.get(history.size() - index - 1);
    }
docs: Returns the app state at the provided index in history. 0 is the newest entry.