lo.Find(s, fn) | First element matching predicate. Returns (T, bool) |
lo.FindOrElse(s, fallback, fn) | First match or fallback value |
lo.FindIndexOf(s, fn) | First match with index. Returns (T, int, bool) |
lo.FindLastIndexOf(s, fn) | Last match with index |
lo.FindKey(m, val) | Find key by value in map |
lo.FindKeyBy(m, fn) | Find key by predicate in map |
lo.IndexOf(s, val) | Index of first occurrence (-1 if not found) |
lo.LastIndexOf(s, val) | Index of last occurrence |
lo.Contains(s, val) | True if slice contains value. Note: prefer slices.Contains (stdlib Go 1.21+) |
lo.ContainsBy(s, fn) | True if any element matches predicate |
lo.Every(s, subset) | True if all subset elements are in s |
lo.EveryBy(s, fn) | True if all elements match predicate |
lo.Some(s, subset) | True if any subset element is in s |
lo.SomeBy(s, fn) | True if any element matches predicate |
lo.None(s, subset) | True if no subset element is in s |
lo.NoneBy(s, fn) | True if no element matches predicate |
lo.Count(s, val) | Count occurrences of value |
lo.CountBy(s, fn) | Count elements matching predicate |
lo.CountValues(s) | Frequency map map[T]int |
lo.CountValuesBy(s, fn) | Frequency map by key function |
lo.Min(s) / lo.Max(s) | Min/max of comparable slice |
lo.MinBy(s, fn) / lo.MaxBy(s, fn) | Min/max by comparison function |
lo.MinIndex(s) / lo.MaxIndex(s) | Index of min/max element |
lo.MinIndexBy(s, fn) / lo.MaxIndexBy(s, fn) | Index of min/max by comparison |
lo.Earliest(vals...) | Earliest time.Time value |
lo.EarliestBy(s, fn) | Earliest by extractor function |
lo.Latest(vals...) | Latest time.Time value |
lo.LatestBy(s, fn) | Latest by extractor function |
lo.First(s) / lo.Last(s) | First/last element. Returns (T, bool) |
lo.FirstOr(s, fallback) | First element or fallback |
lo.FirstOrEmpty(s) | First element or zero-value |
lo.LastOr(s, fallback) | Last element or fallback |
lo.LastOrEmpty(s) | Last element or zero-value |
lo.Nth(s, n) | Element at index n (supports negative). Returns (T, error) |
lo.NthOr(s, n, fallback) | Nth element or fallback |
lo.NthOrEmpty(s, n) | Nth element or zero-value |
lo.Sample(s) | Random element |
lo.SampleBy(s, fn) | Random element matching predicate |
lo.Samples(s, n) | n random elements |
lo.SamplesBy(s, n, fn) | n random elements matching predicate |
lo.IsSorted(s) / lo.IsSortedBy(s, fn) | Check if slice is sorted |
lo.HasPrefix(s, prefix) | True if slice starts with prefix elements |
lo.HasSuffix(s, suffix) | True if slice ends with suffix elements |