private static <T> void addRestItems(@NotNull List<T> out, Iterator<T> iterator) {
    while (iterator.hasNext()) {
      out.add(iterator.next());
    }
  }
private static <T> void addRestItems(@NotNull List<T> out, Iterator<T> iterator)