private int findValid(int increment) {
    List<Place> places = new ArrayList<>();
    int first;
    synchronized (this) {
      first = currentPos + increment;
      for (int idx = first; idx >= 0 && idx < history.size(); idx += increment) {
        places.add(history.get(idx));
      }
    }
    int index = ContainerUtil.indexOf(places, place -> root.isValid(place));
    return index == -1 ? -1 : first + index * increment;
  }
private int findValid(int increment)