jeudi 16 janvier 2020

Difference between as? Type and as Type?

I'm having issues figuring out the difference between these two statements.

The first one makes use of the as? operator to cast the generic annotation class to XYZ

this::class.annotations.find { it is XYZ } as? XYZ ?: return

And the second one makes use of the as? operator and of the null marker

this::class.annotations.find { it is XYZ } as XYZ? ?: return




Aucun commentaire:

Enregistrer un commentaire