public static @Unmodifiable @NotNull <T> List<T> collect(@NotNull Iterator<? extends T> iterator, @NotNull java.util.function.Predicate<? super T> predicate) {
    if (!iterator.hasNext()) return emptyList();
    List<T> list = new ArrayList<>();
    while (iterator.hasNext()) {
      T o = iterator.next();
      if (predicate.test(o)) {
        list.add(o);
      }
    }
    return unmodifiableOrEmptyList(list);
  }
public static @Unmodifiable @NotNull <T> List<T> collect(@NotNull Iterator<? extends T> iterator, @NotNull java.util.function.Predicate<? super T> predicate)