我不明白为什么返回数据时不使用大写字母?
pyserial
答案 0 :(得分:1)
val userList: LiveData<List<UserData>> = Transformations.map(userRepository.getUsers()) { data ->
data.forEach {
it.name = it.name.toUpperCase() //This is what you're missing, as explained by @forpas in the comment section.
Log.i("uppercase", it.name.toUpperCase()) //uppercase working here
}
Log.i("data", data.toString()) //uppercase now there
return@map data
}
自从他第一次回答以来,信用就一直来自@forpas,而不仅仅是将其添加为答案。