Working on typing suggestions and need to order on word frequencies and for this I am using a B4XOrderedMap.
The frequencies are the values and the words the key.
Trying to sort on values but can't get it to work:
Gives in the log:
GetSuggestions, key: pat_deprivation - value: 0
GetSuggestions, key: pat_stats - value: 0
GetSuggestions, key: path_points - value: 0
GetSuggestions, key: patient_count - value: 0
GetSuggestions, key: patient_list - value: 0
GetSuggestions, key: patient_type - value: 0
GetSuggestions, key: patient_warnings - value: 0
GetSuggestions, key: patients - value: 3
GetSuggestions, key: patients_points - value: 0
GetSuggestions, key: pats - value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 3
GetSuggestions, value: 0
GetSuggestions, value: 0
Keys are string and values are int, so no idea what is going on here.
RBS
The frequencies are the values and the words the key.
Trying to sort on values but can't get it to work:
B4X:
If mapSuggestionsCounts.Size > 1 Then
mapSuggestionsCounts.Values.Sort(False)
End If
For i = 0 To mapSuggestionsCounts.Size - 1
Log("GetSuggestions, key: " & mapSuggestionsCounts.Keys.Get(i) & " - value: " & mapSuggestionsCounts.Values.Get(i))
Next
For Each iValue In mapSuggestionsCounts.Values
Log("GetSuggestions, value: " & iValue)
Next
Gives in the log:
GetSuggestions, key: pat_deprivation - value: 0
GetSuggestions, key: pat_stats - value: 0
GetSuggestions, key: path_points - value: 0
GetSuggestions, key: patient_count - value: 0
GetSuggestions, key: patient_list - value: 0
GetSuggestions, key: patient_type - value: 0
GetSuggestions, key: patient_warnings - value: 0
GetSuggestions, key: patients - value: 3
GetSuggestions, key: patients_points - value: 0
GetSuggestions, key: pats - value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 0
GetSuggestions, value: 3
GetSuggestions, value: 0
GetSuggestions, value: 0
Keys are string and values are int, so no idea what is going on here.
RBS