https://kotlinlang.org logo
#getting-started
Title
# getting-started
s

smit01

07/29/2021, 6:00 PM
I still get confused with kotlin generics and delegated properties any good references. I have tried to understand it through official doc but it didn't really helped me so of someone can provide good reference or explain it. <*> projection confuses me
👍 1
m

mkrussel

07/29/2021, 8:39 PM
Those are the best guides I've seen on variance, and would recommend everyone read them.
👍 1
m

Michael Schleichardt

07/29/2021, 9:12 PM
Assume you have a Type
Thing<T>
The <*> projection means you neither want to read nor write something with
T
, but you still can use non-generic methods like
size
on
List
which returns just a number.
👍 1
c

CLOVIS

07/30/2021, 7:17 PM
How similar is
*
and
Nothing
? In both cases, a function that returns it can't be called
m

mkrussel

07/30/2021, 7:21 PM
If I remember correctly using
*
makes all in usages of the type be
Nothing
and all outs act as
Any?
(or the upper bounds if not the default.
a

Alejandro Rios

07/30/2021, 7:42 PM
@CLOVIS
Star projections
link explain about it
3 Views