diff options
Diffstat (limited to 'android/util.go')
| -rw-r--r-- | android/util.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/android/util.go b/android/util.go index 8dbf21459..65c5f1b28 100644 --- a/android/util.go +++ b/android/util.go @@ -79,6 +79,20 @@ func JoinWithSuffix(strs []string, suffix string, separator string) string { return string(ret) } +func SortedIntKeys(m interface{}) []int { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Map { + panic(fmt.Sprintf("%#v is not a map", m)) + } + keys := v.MapKeys() + s := make([]int, 0, len(keys)) + for _, key := range keys { + s = append(s, int(key.Int())) + } + sort.Ints(s) + return s +} + func SortedStringKeys(m interface{}) []string { v := reflect.ValueOf(m) if v.Kind() != reflect.Map { |