func (s *sortedMap) Len() int {
	return len(s.keys)
}
Functions for sort.Interface
package pp
import (
	"reflect"
	"sort"
)
func sortMap(value reflect.Value) *sortedMap {
	if value.Type().Kind() != reflect.Map {
		panic("sortMap is used for a non-Map value")
	}
	keys := make([]reflect.Value, 0, value.Len())
	values := make([]reflect.Value, 0, value.Len())
	mapKeys := value.MapKeys()
	for i := 0; i < len(mapKeys); i++ {
		keys = append(keys, mapKeys[i])
		values = append(values, value.MapIndex(mapKeys[i]))
	}
	sorted := &sortedMap{
		keys:   keys,
		values: values,
	}
	sort.Stable(sorted)
	return sorted
}
type sortedMap struct {
	keys   []reflect.Value
	values []reflect.Value
}