`CHEESE_DATA.map { Cheese(id = 0, name = it) }` `...
# getting-started
s
CHEESE_DATA.map { Cheese(id = 0, name = it) }
CHEESE_DATA
is an ArrayList. If we apply
map
with the above function then should it not create a list of Cheese objects with id
0
and name
it
. The result seems to be Cheese object with an incremented value for id and
it
name. What am I missing? https://github.com/googlesamples/android-architecture-components/blob/6248bed977e7a82d6f3199e8a940a39b7d6f051c/PagingSample/app/src/main/java/paging/android/example/com/pagingsample/CheeseDb.kt#L54
a
Maybe auto generated id by room?
For more information on how Room treats that annotation, see: https://developer.android.com/reference/android/arch/persistence/room/PrimaryKey#autogenerate
s
Thanks. That's right. But otherwise my assertion would be correct.
a
@Sudhir Singh Khanger your assertion is correct,
map
doesn't change
id
, room does it
s
Thanks.