Slackbot
10/03/2022, 9:44 PMtony
10/03/2022, 9:57 PM@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
to get my IDE to stop complaining about returning null from that map
.Chris Lee
10/03/2022, 10:18 PMpublic inline fun <reified S> Provider<S>.filter(crossinline predicate: (S) -> Boolean): Provider<S> {
return flatMap {
if (predicate(it)) {
Providers.of(it)
} else {
Providers.notDefined()
}
}
}
Chris Lee
10/03/2022, 10:18 PMnull
is returned - use Providers.notDefined()
. The flatMap
is there to unwrap the providers.Chris Lee
10/03/2022, 10:19 PMbaseline.set(extension.baseline.filter { it.asFile.exists() })
Chris Lee
10/03/2022, 10:40 PM