Dalinar
12/15/2018, 8:22 AM`
private val requests: Cache<String, Req> = Caffeine.newBuilder()
.removalListener<String, Req> { clientOrderID: String?, req: Req?, removalCause: RemovalCause ->
clientOrderID!!; req!!
...
req.close()
}
`
with Guava the code would compile without the `?on the parameters
the reason I added these
!!where I did was because I refer to these variables several times in the code afterwards. However what I'm asking is if there is a nicer syntax where I can somehow get rid of the
?` on the parameters
very strange, my other similar caches built in the same way have no problem accepting non-nullable parameters in removalListener
- it's just this particular one that is the problemkarelpeeters
12/15/2018, 9:27 AMDalinar
12/15/2018, 9:53 AMCaffeine
one and ran into this problem. They shouldn't be null
as can be seen in the <>karelpeeters
12/15/2018, 1:14 PM?
and you'll be using platform types.Dalinar
12/15/2018, 2:35 PMs was because it wouldn't compile without them. They strange thing is that I have 3 different caches created in this way, but with different types inside <> and 2 of them require the
?and the other one doesn't and I really can't see what the difference is. Caffeeine is very syntax-similar to Guava, and when I replaced it with Guava none of them require
?`.. it's a puzzlekarelpeeters
12/15/2018, 3:04 PM@Nullable
annotation.Dalinar
12/15/2018, 3:05 PMkarelpeeters
12/15/2018, 3:05 PM