Edoardo Luppi
10/19/2020, 9:54 AMproviders.forEachIndexed { index, provider ->
if (index == 0) {
whatsNewPanel.setProvider(provider)
}
...
Is there a function/extension which lets me move that whatsNewPanel.setProvider(provider)
in a separate space? Possibly in the same call chainMranders
10/19/2020, 10:47 AMfirstOrNull
to get the first element of the collection (or null if it is empty) and then ?let
to access that value null safely:
providers.firstOrNull()?.let { whatsNewPanel.setProvider(it) }