This message was deleted.
# getting-started
s
This message was deleted.
t
Cache<>
doesn't exist in kotlin you need to specify the types inside the brackets
c
Also don’t call your own interface
Cache
as well.
a
1. Remove the
<>
from
: Cache<>
2. Add
: Void
otherwise won't compile: -
fun put(key: K, value: V) : Void
-
fun evict(key: K) : Void
Mind that Spring's Cache isn't generic thus no
<>
, or
<K, V>
are allowed after
: Cache
. For instance you could extend a generic one this way:
interface Cache<K, V> : javax.cache.Cache<K,V> { ... }
t
thank you all,
by the way, what does this means
registrar: (key: K) -> V?)
In the following function
fun getOrPut(key: K, fun getOrPut(key: K, registrar: (key: K) -> V?): V?: V?
i thinks
registrar
is something likes the arguments name, so what are the rest? is it a lambda ?
t
(key: K) -> V?)
is the signature of a lambda type, yes (yet, the
key
could be avoided, so it's pretty much the same like
(K) -> V?
)
👍 1
t
thanks @thana