public static Map getCardinalityMap(final Collection coll) {
        Map count = new HashMap();
        for (Iterator it = coll.iterator(); it.hasNext();) {
            Object obj = it.next();
            Integer c = (Integer) (count.get(obj));
            if (c == null) {
                count.put(obj,INTEGER_ONE);
            } else {
                count.put(obj,new Integer(c.intValue() + 1));
            }
        }
        return count;
    }
public static Map getCardinalityMap ( final Collection coll ) { Map count = new HashMap ( ) ; for ( Iterator it = coll . iterator ( ) ; it . hasNext ( ) ; ) { Object obj = it . next ( ) ; Integer c = ( Integer ) ( count . get ( obj ) ) ; if ( c == null ) { count . put ( obj , INTEGER_ONE ) ; } else { count . put ( obj , new Integer ( c . intValue ( ) + 1 ) ) ; } } return count ; }
Returns a {@link Map} mapping each unique element in the given
{@link Collection} to an {@link Integer} representing the number
of occurrences of that element in the {@link Collection}.
<p>
Only those elements present in the collection will appear as
keys in the map.

@param coll  the collection to get the cardinality map for, must not be null
@return the populated cardinality map