// Sort sorts version from newest to oldest.
169330
func (v Versions) Sort() {
	sort.Slice(v, func(i, j int) bool {
		return v[i].NewerThan(v[j])
	})
}
399635
func (h *BytesRefHash) Sort(comp func(a, b []byte) bool) []int {
	compact := h.compact()
	s := newBytesRefIntroSorter(h, compact, comp)
	s.Sort(0, h.count)
	// TODO remove this
	// for i, _ := range compact {
	// 	if compact[i+1] == -1 {
	// 		break
	// 	}
	// 	assert(!s.Less(i+1, i))
	// 	if ok := !s.Less(i+1, i); !ok {
	// 		fmt.Println("DEBUG1", compact)
	// 		assert(ok)
	// 	}
	// }
	return compact
}
1137056
func SortBy(rows [][]string, lesses ...LessFunc) *MultiSorter {
	return &MultiSorter{
		data: rows,
		less: lesses,
	}
}
384138
func (f *FieldSetType) SortAll(sortList ...string) *FieldSetType {
	elem := f.fields
	size := len(elem)
	f.fields = make([]fields.FieldInterface, size)
	var sortSlice []string
	if len(sortList) == 1 {
		sortSlice = strings.Split(sortList[0], ",")
	} else {
		sortSlice = sortList
	}
	for k, fieldName := range sortSlice {
		if oldIndex, ok := f.fieldMap[fieldName]; ok {
			f.fields[k] = elem[oldIndex]
			f.fieldMap[fieldName] = k
		}
	}
	return f
}
595882
func (api *CDROMAPI) SortBySize(reverse bool) *CDROMAPI {
	api.sortBy("SizeMB", reverse)
	return api
}
715517
func (d *Dataset) SortReverse(column string) *Dataset {
	return d.internalSort(column, true)
}
1056606
func SortByRevision(list []*rspb.Release) {
	s := &sorter{list: list}
	s.less = func(i, j int) bool {
		vi := s.list[i].Version
		vj := s.list[j].Version
		return vi < vj
	}
	sort.Sort(s)
}
364068
func Sort(list cty.Value) (cty.Value, error) {
	return SortFunc.Call([]cty.Value{list})
}
1367085
func (s Seq) Sort() Seq {
	if s.Len() == 0 {
		return s
	}
	values := s.Array()
	sort.Float64s(values)
	return Seq{Provider: Array(values)}
}
682586
func (s *CatHealthService) Sort(fields ...string) *CatHealthService {
	s.sort = fields
	return s
}
530328
func (s *CatCountService) Sort(fields ...string) *CatCountService {
	s.sort = fields
	return s
}
1359104
func (m *SpiderMenu) Sort(col int, order walk.SortOrder) error {
	m.sortColumn, m.sortOrder = col, order

	sort.Sort(m)

	return m.SorterBase.Sort(col, order)
}
432179
func (o Oids) Sort() Oids {
	c := make(Oids, len(o))
	copy(c, o)
	sort.Sort(sortableOids{c})
	return c
}
146806
func (g *Graph) Sort() (sorted []util.T, ok bool) {
	if g.sorted != nil {
		return g.sorted, true
	}

	sort := &graphSort{
		sorted: make([]util.T, 0, len(g.nodes)),
		deps:   g.Dependencies,
		marked: map[util.T]struct{}{},
		temp:   map[util.T]struct{}{},
	}

	for node := range g.nodes {
		if !sort.Visit(node) {
			return nil, false
		}
	}

	g.sorted = sort.sorted
	return g.sorted, true
}
167178
func Sort(data Interface) {
	n := data.Len()
	if fs, ok := data.(*funcs); ok {
		quickSort_func(fs.lessSwap, 0, n, maxDepth(n))
	} else {
		quickSort(data, 0, n, maxDepth(n))
	}
}
506497
func (t *PackageList) Sorted() []*build.Package {
	t.ensureInit()

	keys := make([]string, len(t.dirpool))
	i := 0
	for k := range t.dirpool {
		keys[i] = k
		i++
	}
	sort.Strings(keys)

	result := make([]*build.Package, len(t.dirpool))
	i = 0
	for _, k := range keys {
		result[i] = t.dirpool[k]
		i++
	}

	return result
}
776374
func sort(s1, s2 string) (shorter, longer string) {
	if utf8.RuneCountInString(s1) < utf8.RuneCountInString(s2) {
		return s1, s2
	}
	return s2, s1
}