Printing out all the subsets of a set I am concerned about creating too many objects in my code. 
Am I using duplicate code? Can I cut down on the number of lines of code?


Note: I only want to use recursion to solve this. Any suggestions on the design of the program and naming convention used here are appreciated.

import java.util.ArrayList;

class Subsets {
    public static void main(String[] args) {
        ArrayList&lt;Integer&gt; superSet = new ArrayList&lt;Integer&gt;();
        superSet.add(1);
        superSet.add(2);
        superSet.add(3);
        superSet.add(4);
        ArrayList&lt;ArrayList&lt;Integer&gt;&gt; lists = Subsets.getSubsets(superSet);
        System.out.println("final set ==&gt; " + lists);
    }

    static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; getSubsets(ArrayList&lt;Integer&gt; SubList) {
        if (SubList.size() &gt; 0) {
            ArrayList&lt;ArrayList&lt;Integer&gt;&gt; list = addToList(SubList.remove(0),
                    SubList);
            return list;
        } else {
            ArrayList&lt;ArrayList&lt;Integer&gt;&gt; list = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;();
            list.add(SubList);
            return list;
        }
    }

    private static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; addToList(
            Integer firstElement, ArrayList&lt;Integer&gt; SubList) {
        ArrayList&lt;ArrayList&lt;Integer&gt;&gt; listOfLists = getSubsets(SubList);
        ArrayList&lt;ArrayList&lt;Integer&gt;&gt; superList = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;();
        for (ArrayList&lt;Integer&gt; iList : listOfLists) {
            superList.add(new ArrayList&lt;Integer&gt;(iList));
            iList.add(firstElement);
            superList.add(new ArrayList&lt;Integer&gt;(iList));
        }
        return superList;
    }
}
You can combine your two methods in just one method, making the whole process much easier to understand due to less "jumping around".

static &lt;T&gt; List&lt;List&lt;T&gt;&gt; getSublists(List&lt;T&gt; list) {
    if (list.isEmpty()) {
        // if empty, return just that empty list
        return Collections.singletonList(list);
    } else {
        List&lt;List&lt;T&gt;&gt; sublists = new ArrayList&lt;List&lt;T&gt;&gt;();
        T first = list.get(0);
        // for each sublist starting at second element...
        for (List&lt;T&gt; sublist : getSublists(list.subList(1, list.size()))) {
            //... add that sublist with and without the first element
            // (two lines more, but this preserves the original order)
            List&lt;T&gt; sublistWithFirst= new ArrayList&lt;T&gt;();
            sublistWithFirst.add(first);
            sublistWithFirst.addAll(sublist);
            sublists.add(sublist);
            sublists.add(sublistWithFirst);
        }
        return sublists;
    }
}


Some more points:


I'd recommend using the more generic List whenever possible.
Also, no need to restrict the method to lists of integers.
That code definitely deserves some comments.
You are actually returning sub-lists; name your methods accordingly.
Note that by calling remove on the input list, you are modifying the original list!