karelpeeters
02/01/2019, 11:15 AM.mapNotNull { it.foo }.filter { barFunction(it) }dG
02/01/2019, 11:19 AMfoo. I had intended to get a list of elements of someListPavlo Liapota
02/01/2019, 11:22 AMsomeList
.filter(it.foo != null && barFunction(it.foo))
if foo is val without custom getter, then this should workdG
02/01/2019, 11:24 AMdG
02/01/2019, 11:24 AMtddmonkey
02/01/2019, 11:45 AMbarFunction an extension method on a nullable receiver of the type in your list?tddmonkey
02/01/2019, 11:45 AMsomeList
.filter(it.foo.barFunction())Pavlo Liapota
02/01/2019, 11:47 AMsomeList
.filter(it.foo?.barFunction() == true)tddmonkey
02/01/2019, 11:49 AMfun Fun?.barFunction() = this != null && barFunction(this)tddmonkey
02/01/2019, 11:50 AMkarelpeeters
02/01/2019, 11:51 AMtddmonkey
02/01/2019, 11:53 AMdG
02/01/2019, 12:06 PMbarFunction is already a method on a wrapper to a library. I guess my only option left is to overload barFunction on that wrappertddmonkey
02/01/2019, 12:12 PMdG
02/01/2019, 12:16 PMNikky
02/01/2019, 1:57 PM.filter { foo?.let { barfunction(it) } ?: false }
would be my sugestion