Go · Interface
sort.Interface
sort.Interface is the contract for sorting a custom indexed collection. Implement Len, Less, and Swap; then use Sort, Stable, or other sort package functions.
Last updated
Syntax
type Interface interface { Len() int; Less(i, j int) bool; Swap(i, j int) }In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
SortStableIsSortedReverseIntSliceFloat64SliceStringSlice