docs: public static <E> Set<E> copyOf(Iterator<? extends E> elementsIterator) {
      Set<E> result = new HashSet<>();
      while (elementsIterator.hasNext()) {
        result.add(elementsIterator.next());
      }
      return Collections.unmodifiableSet(result);
    }