Sort a linkedlist with 3 elements 0, 1 and 2
The mash-up you continue to have with Objects and primitives is something that is easy to resolve, yet you don't. Is there some reason I am missing why it is important to convert your data to an Integer Object before converting it back to an int?


public void add(Integer item) {



Why can't that be:

public void add(int value) {


???? Your Node class stores it as an int, so there is no reason to do the multiple conversions.

The algorithm you have used for the 'sorting' is similar to what I would do. There are a few nitpicks though (one of them is not so small....):


Use Post-increment and Post-Decrement operators:


a[node.item] = a[node.item] + 1;



and


a[i] = a[i] - 1;



should be:

a[node.item]++;


and

a[i]--;

Why use a linked list at all? Seriously, what does the Node concept buy you? This problem could easily be solved with a primitive array (... or an ArrayList, or LinkedList if you were not using primitives .....). If your data was stored as an array, it would be as simple as:

public void sortZeroesOnesAndTwos() {
    int[] itemcount = new int[3];

    for (int item : data) {
        itemcount[item]++; 
    }

    int pos = 0;
    for (int item = 0; item &lt; a.length; item++) {
        while (itemcount[item]-- &gt; 0) {
            data[pos++] = item;
        }
    }
}