private ArrayList<ColorAmount> sortMostDominantColors() {

        ArrayList<ColorAmount> dominantColours = new ArrayList<ColorAmount>();

        Iterator it = map.entrySet().iterator();

        while (it.hasNext()) {
            Map.Entry pairs = (Map.Entry) it.next();
            dominantColours.add(new ColorAmount((PixelColor) pairs.getKey(), (MutableInt) pairs.getValue()));
            it.remove();
        }

        if (!dominantColours.isEmpty()) {
            Collections.sort(dominantColours, new Comparator<ColorAmount>() {
                public int compare(ColorAmount o1, ColorAmount o2) {
                    if (o1.getAmount().equals(o2.getAmount()))
                        return 0;
                    return o1.getAmount() > o2.getAmount() ? -1 : 1; // Descending
                }
            });
        }

        return dominantColours;

    }