I was looking for a solution that wasn't as huge as the ones posted here. This targets Java 7, so it will require a handful of pastes for versions 5 and 6.
Set> powerSetofNodes(Set
Here's some example code to test:
Set hs = new HashSet<>();
hs.add(1);
hs.add(2);
hs.add(3);
hs.add(4);
for(Set s : powerSetofNodes(hs)) {
System.out.println(Arrays.toString(s.toArray()));
}