Question: ListTools count for each unique element

I frequently have a list of numbers and what I want is a sorted list of unique elements with a count of how many times each element appears.  Is there some way to do this with ListTools?

Here is my code:

listhist := proc(L)
local S, T, i;
T := table(sparse):
for i in L do T[i] := T[i]+1; end do;
S := sort(map(op,[indices(T)]));
[seq([i,T[i]], i=S)];
end proc:

Please Wait...