what’s the difference between `interface Stack&lt...
# getting-started
o
what’s the difference between
interface Stack<T : Any>
and
interface Stack<T>
?
T
already means literally anything
m
by default T implies
T : Any?
so includes nullable types. Your first declaration excludes nullable types from the domain.
o
I see, nice ok
true, if you go to implement this interface with a class that has type just
T
, feeding that
T
back to Stack<T> will complain
m
not sure I understand what you mean, sorry 😕
o
means I tried it, it’s as you said 👍🏻
m
okay good! So the compiler prevents you from declaring a
Stack<Int?>
if you used the first definition, right?
o
correct
👌 2