brett.wooldridge
05/24/2017, 6:24 AMin
operator would be consistently interpreted as containsKey(..)
. The fact that it does not cost me over an hour of debugging, and I think is a surprising result for users. I would expect to be able to switch a collection between HashMap
, ConcurrentHashMap
, ... any Map
and have the code behave consistently.Andreas Sinz
05/24/2017, 6:58 AMin
operator is mapped to contains()
in kotlin. So the problem with ConcurrentHashMap is, that it defines its own legacy contains()
which calls containsValue()
. There is not really a way to override the behaviour of ConcurrentHashMap.contains()
outside of the class itselfmg6maciej
05/24/2017, 7:03 AMmg6maciej
05/24/2017, 7:03 AMbrett.wooldridge
05/24/2017, 7:19 AMbrett.wooldridge
05/24/2017, 7:19 AMbrett.wooldridge
05/24/2017, 7:20 AMbrett.wooldridge
05/24/2017, 7:26 AMmg6maciej
05/24/2017, 7:26 AMbrett.wooldridge
05/24/2017, 7:27 AMbrett.wooldridge
05/24/2017, 7:28 AMmg6maciej
05/24/2017, 7:29 AMbrett.wooldridge
05/24/2017, 7:30 AMbrett.wooldridge
05/24/2017, 7:35 AMbrett.wooldridge
05/24/2017, 7:37 AM