code: public static IntSet from(Set<Integer> integerSet) {
        if (integerSet instanceof IntSet) {
           return (IntSet) integerSet;
        }
        int size = integerSet.size();
        switch (size) {
           case 0:
              return EmptyIntSet.getInstance();
           case 1:
              return new SingletonIntSet(integerSet.iterator().next());
           default:
              return new SmallIntSet(integerSet);
        }
     }
docs: Returns an IntSet based on the provided Set. This method tries to return or create the most performant IntSet
  based on the Set provided. If the Set is already an IntSet it will just return that. The returned IntSet may or
  may not be immutable, so no guarantees are provided from that respect.
  @param integerSet IntSet to create from
  @return the IntSet that is equivalent to the Set