What is wrong with this code? It should return the power set of a given set.
static public <T> ArrayList< ArrayList<T> > powerSet(ArrayList<T> inputSet){
ArrayList< ArrayList<T> > power = new ArrayList< ArrayList<T> >();
if(inputSet.isEmpty()){
power.add(new ArrayList<T>());
return power;
}
T element = inputSet.remove(0);
ArrayList< ArrayList<T> > partial = powerSet(inputSet);
power.addAll(partial);
for(ArrayList<T> sub : partial){
sub.add(element);
power.add(sub);
}
return power;
}