High-performance Concurrent MultiMap Java/Scala

后端 未结 10 1193
無奈伤痛
無奈伤痛 2020-12-12 15:42

I am looking for a high-performance, concurrent, MultiMap. I have searched everywhere but I simply cannot find a solution that uses the same approach as ConcurrentHashMap (O

相关标签:
10条回答
  • 2020-12-12 16:02

    There is one in akka although I haven't used it.

    0 讨论(0)
  • 2020-12-12 16:06

    you should give ctries a try. here is the pdf.

    0 讨论(0)
  • 2020-12-12 16:08

    I am a bit late on this topic but I think, nowadays, you can use Guava like this:

    Multimaps.newSetMultimap(new ConcurrentHashMap<>(), ConcurrentHashMap::newKeySet)
    
    0 讨论(0)
  • 2020-12-12 16:09

    I made a ConcurrentMultiMap mixin which extends the mutable.MultiMap mixin and has a concurrent.Map[A, Set[B]] self type. It locks per key, which has O(n) space complexity, but its time complexity is pretty good, if you aren't particularly write-heavy.

    0 讨论(0)
  • 2020-12-12 16:13

    Why not wrap ConcurrentHashMap[T,ConcurrentLinkedQueue[U]] with some nice Scala-like methods (e.g. implicit conversion to Iterable or whatever it is that you need, and an update method)?

    0 讨论(0)
  • 2020-12-12 16:14

    Have you tried Google Collections? They have various Multimap implementations.

    0 讨论(0)
提交回复
热议问题