March 2019
Intermediate to advanced
336 pages
9h 9m
English
The Less method of the multiSorter class takes the integers i and j and compares the element at index i to the element at index j:
func (multiSorter *multiSorter) Less(i int, j int) bool { var p *Commit var q *Commit p = &multiSorter.Commits[i] q = &multiSorter.Commits[j] var k int for k = 0; k < len(multiSorter.lessFunction)-1; k++ { less := multiSorter.lessFunction[k] switch { case less(p, q): return true case less(q, p): return false } } return multiSorter.lessFunction[k](p, q)}
Read now
Unlock full access