https://kotlinlang.org logo
Title
s

Slackbot

09/23/2019, 11:48 AM
This message was deleted.
t

thana

09/23/2019, 12:20 PM
Cache<>
doesn't exist in kotlin you need to specify the types inside the brackets
c

cedric

09/23/2019, 6:09 PM
Also don’t call your own interface
Cache
as well.
a

Amir Gur

09/24/2019, 10:48 PM
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

Tuang

09/25/2019, 8:26 AM
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

thana

09/25/2019, 9:00 AM
(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

Tuang

09/25/2019, 9:04 AM
thanks @thana