Dim L As List
L.Initialize
Dim M As Map
M.Initialize
'Create the data
Dim i As Int
For i = 0 To 100
L.Add(Rnd(0,5))
Next
'Store each value as a map key with it's value maintaining a count of how many times the
'value has been stored
For Each Val As Int In L
M.Put(Val,M.GetDefault(Val,0)+1)
Next
'Add the maps keys to a list so it can be sorted
Dim L1 As List
L1.Initialize
For Each K As Int In M.Keys
L1.Add(K)
Next
'Sort the list
L1.Sort(True)
'Report the item (Key) and how many times it was stored.
For Each K As Int In L1
Log(K & " : " & M.Get(K))
Next