static void forEachPathSegment(@NotNull String path, char separator, @NotNull Predicate<? super String> consumer) {
    int position = path.indexOf(separator);
    int length = path.length();
    while (position >= 0 && position < length) {
      String subPath = path.substring(0, position);
      if (!consumer.test(subPath)) {
        return;
      }
      position = path.indexOf(separator, position + 1);
    }
    consumer.test(path);
  }
static void forEachPathSegment(@NotNull String path, char separator, @NotNull Predicate<? super String> consumer)