How to log inside Kotlin's filter function?

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?

Bob*_*Bob 5

Have you tried that? That will work properly.

val list = datalist.filter {
     Log.d("tag", " ... ")
     it.postId == currentPostFilterId
}
Run Code Online (Sandbox Code Playgroud)