code: public static IntSet from(PrimitiveIterator.OfInt iterator) {
        boolean hasNext = iterator.hasNext();
        if (!hasNext) {
           return EmptyIntSet.getInstance();
        }
        int firstValue = iterator.nextInt();
        hasNext = iterator.hasNext();
        if (!hasNext) {
           return new SingletonIntSet(firstValue);
        }
        // We have 2 or more values so just set them in the SmallIntSet
        SmallIntSet set = new SmallIntSet();
        set.set(firstValue);
        iterator.forEachRemaining((IntConsumer) set::set);
        return set;
     }
docs: Returns an IntSet based on the ints in the iterator. This method will try to return the most performant IntSet
  based on what ints are provided if any. The returned IntSet may or may not be immutable, so no guarantees are
  provided from that respect.
  @param iterator values set in the returned set
  @return IntSet with all the values set that the iterator had