android/guava/src/com/google/common/collect/Sets.java
@GwtCompatible(serializable = false)
  public static <E> Set<Set<E>> powerSet(Set<E> set) {
    return new PowerSet<E>(set);
  }
@GwtCompatible(serializable = false)
  public static <E> Set<Set<E>> powerSet(Set<E> set) {
    return new PowerSet<E>(set);
  }
@ GwtCompatible ( serializable = false ) public static < E > Set < Set < E > > powerSet ( Set < E > set ) { return new PowerSet < E > ( set ) ; }
Returns the set of all possible subsets of {@code set}. For example, {@code
powerSet(ImmutableSet.of(1, 2))} returns the set {@code {{}, {1}, {2}, {1, 2}}}.

<p>Elements appear in these subsets in the same iteration order as they appeared in the input
set. The order in which these subsets appear in the outer set is undefined. Note that the power
set of the empty set is not the empty set, but a one-element set containing the empty set.

<p>The returned set and its constituent sets use {@code equals} to decide whether two elements
are identical, even if the input set uses a different concept of equivalence.

<p><i>Performance notes:</i> while the power set of a set with size {@code n} is of size {@code
2^n}, its memory usage is only {@code O(n)}. When the power set is constructed, the input set
is merely copied. Only as the power set is iterated are the individual subsets created, and
these subsets themselves occupy only a small constant amount of memory.

@param set the set of elements to construct a power set from
@return the power set, as an immutable set of immutable sets
@throws IllegalArgumentException if {@code set} has more than 30 unique elements (causing the
power set size to exceed the {@code int} range)
@throws NullPointerException if {@code set} is or contains {@code null}
@see <a href="http://en.wikipedia.org/wiki/Power_set">Power set article at Wikipedia</a>
@since 4.0
Returns the set of all possible subsets of { @code set } . For example { @code powerSet ( ImmutableSet . of ( 1 2 )) } returns the set { @code {{ } { 1 } { 2 } { 1 2 }}} .