Spot the bug in the SKU index

from Collections
Kotlin 2.4.10 intermediate 4 min 1 issue to find

This function must reject duplicate SKUs. Find the bug.

kotlin
data class Product(val sku: String, val name: String)

fun indexProducts(products: List<Product>): Map<String, Product> {
    return products.associateBy { it.sku }
}
Open in playground
Report an error