public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) {
    HashSet<E> set = newHashSet();
    while (elements.hasNext()) {
      set.add(elements.next());
    }
    return set;
  }
Creates a <i>mutable</i> {@code HashSet} instance containing the given elements in unspecified
order.

@param elements the elements that the set should contain
@return a new {@code HashSet} containing those elements (minus duplicates)
fbcore/src/main/java/com/facebook/common/internal/Sets.java