Ink
val productShopInfoItems = productListItemMapper.toShopInfoItems(it.snapshot) state.productList.value?.forEach { product -> productShopInfoItems.forEach { shop -> if(product.productId == shop.productId){ product.shopInfoItemList += shop } } }
data class ProductItem( val productId: String = "", val productName: String = "", var shopInfoItemList: List<ShopInfoResponseItem> = emptyList<ShopInfoResponseItem>() )
Roukanken
shopsByProductId = productShopInfoItems.groupBy { it.productId } state.productList.value?.forEach { it.shopInfoItemList = shopsByProductId[it.productId] ?: emptyList() }
key -> list of every item where f(item) == key
A modern programming language that makes developers happier.