code: public static <T> Set<T> toSet(Iterator<T> iterator)
      {
          Objects.requireNonNull(iterator, "The iterator is null");
          return Iterators.toCollection(iterator, new LinkedHashSet<T>());
      }
docs: Drains all elements from the given iterator into a set
  
  @param <T> The element type
  @param iterator The iterator
  @return The set