• Brad Fitzpatrick's avatar
    sort: add Slice, SliceStable, and SliceIsSorted · 22a2bdfe
    Brad Fitzpatrick authored
    Add helpers for sorting slices.
    
    Slice sorts slices:
    
        sort.Slice(s, func(i, j int) bool {
            if s[i].Foo != s[j].Foo {
                return s[i].Foo < s[j].Foo
            }
            return s[i].Bar < s[j].Bar
        })
    
    SliceStable is the same, but does a stable sort.
    
    SliceIsSorted reports whether a slice is already sorted.
    
    Fixes #16721
    
    Change-Id: I346530af1c5dee148ea9be85946fe08f23ae53e7
    Reviewed-on: https://go-review.googlesource.com/27321
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    22a2bdfe
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...