lan*_*nyf 2 android filter kotlin
Using Kotlin to filter a list
var datalist: List<DataType>
val list = datalist.filter {it.Id == currentFilterId}
Run Code Online (Sandbox Code Playgroud)
would like to put in some log to debug the data
val list = datalist.filter {
Log.d(TAG, "$it, currentFilterId: $currentFilterId)
it.postId == currentPostFilterId
}
Run Code Online (Sandbox Code Playgroud)
how to put in multiple lines of statements inside the filter function?
Have you tried that? That will work properly.
val list = datalist.filter {
Log.d("tag", " ... ")
it.postId == currentPostFilterId
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
341 次 |
| 最近记录: |