#group-by Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Kotlin groupBy and partition
`groupBy` returns a `Map<Key, List<T>>` keyed by what the lambda returns. `partition` is a special-case `groupBy` for booleans — returns `(matching, nonMatching)` Pair.
Rust Group By a Key (fold into HashMap)
No built-in `group_by`, but `fold` into a `HashMap` does the same thing in two lines — and the type system tracks keys / values correctly.
Python group_by — Group Items by a Key
A dict-returning groupby that doesn't require sorted input. Like itertools.groupby but materializes the groups so consumers can iterate them multiple times.
TypeScript groupBy (with key callback)
Group a list into a record keyed by whatever the callback returns. Like Lodash _.groupBy or the new Object.groupBy in modern runtimes. Generic enough to handle string, number, or symbol keys.
SQL GROUP BY — Aggregation Basics
`GROUP BY` collapses rows into buckets; the SELECT list must be aggregates OR grouped columns. The most common reporting pattern in SQL.