23 lines
485 B
Go
23 lines
485 B
Go
package gtq
|
|
|
|
// UIntSlice just subtypes []uint to fulfill sort.Interface, as demonstrated
|
|
// for other types in the sort package.
|
|
type UIntSlice []uint
|
|
|
|
// Len helps fulfill sort.Interface.
|
|
func (list UIntSlice) Len() int {
|
|
return len(list)
|
|
}
|
|
|
|
// Less helps fulfill sort.Interface.
|
|
func (list UIntSlice) Less(i, j int) bool {
|
|
return list[i] <= list[j]
|
|
}
|
|
|
|
// Swap helps fulfill sort.Interface
|
|
func (list UIntSlice) Swap(i, j int) {
|
|
tmp := list[i]
|
|
list[i] = list[j]
|
|
list[j] = tmp
|
|
}
|