We break down how to work with collection grouping in Kotlin via
groupBy: why the result is
Map<K, List<T>>, how to read groups safely (iteration and lookup by key with
?:), how to normalize keys (
trim()/
lowercase()), and how to use the overload
groupBy(keySelector, valueTransform) to store only the data you actually need inside the groups.