gtq/uintslice.go
Tessa Nordgren 5d5af6e926
Some checks failed
continuous-integration/drone/push Build is failing
minor improvements from static code analysis
2022-02-18 12:09:52 -08:00

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
}