lannyf lannyf - 6 months ago 83
Android Question

how to log insider kotlin's filter function?

using kotlin to filter a list

var datalist: List<DataType>
val list = datalist.filter {it.Id == currentFilterId}

would like to put in some log to debug the data

val list = datalist.filter {
Log.d(TAG, "$it, currentFilterId: $currentFilterId)
it.postId == currentPostFilterId

how to put in multiple lines of statements inside the filter function?

Bob Bob
Answer Source

Have you tried that? That will work properly.

val list = datalist.filter {
     Log.d("tag", " ... ")
     it.postId == currentPostFilterId
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download