groostav
08/02/2023, 9:27 PMsingle()
extension functions dont have htem. I thought that something like
val myList: List<GeneralType> = ...
val x = myList.single { it is SpecificType }
would start to smartcast x
to SpecificType
instead of GeneralType
during some upgrade given that we have contracts. But it hasnt. Is there a discussion about this somewhere? I was looking forward to it :(ephemient
08/02/2023, 10:46 PMephemient
08/02/2023, 10:49 PM.firstNotNullOf { it as? SpecificType }
is close but a little differentgroostav
08/02/2023, 10:49 PMfirstIsInstance
is like a combination of first
and filterIsInstance
groostav
08/02/2023, 10:50 PMdmitriy.novozhilov
08/03/2023, 6:58 AM