mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
762 B
762 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Max | max | it/find.go#L295 | it | find |
|
https://go.dev/play/p/9GaTX3-zf |
|
|
110 |
Searches the maximum value of a collection. Returns the largest element found.
Examples:
seq := func(yield func(int) bool) {
_ = yield(5)
_ = yield(2)
_ = yield(8)
_ = yield(1)
_ = yield(9)
}
max := it.Max(seq)
// max == 9
seq := func(yield func(string) bool) {
_ = yield("zebra")
_ = yield("apple")
_ = yield("banana")
}
max := it.Max(seq)
// max == "zebra" (lexicographically largest)