@NotNull
  private static Condition<Integer> createStopFunction(final int maxNodeCount) {
    return new Condition<>() {
      private int count = maxNodeCount;

      @Override
      public boolean value(Integer integer) {
        count--;
        return count < 0;
      }
    };
  }
@NotNull
  private static Condition<Integer> createStopFunction(final int maxNodeCount)