Why there is no ConcurrentLinkedHashMap class in jdk?

后端 未结 3 2018
旧时难觅i
旧时难觅i 2021-02-14 17:45

This question follows directly from my previous question here in SO . I think the answer to my second question is no . So I would like understand why there is no ConcurrentLinke

3条回答
  •  清酒与你
    2021-02-14 18:14

    Why there is no ConcurrentLinkedHashMap class in jdk?

    You would need to ask the Oracle Java guys that, but I imagine that it is a combination of:

    • a perception that not many people would need it, and
    • the inherent difficulties in implementing data structures with good performance properties in highly concurrent use cases.

    In this case, it seems to me that implementing the collection class so that iterating the key/value/entry sets is not a concurrency bottleneck would be ... um ... difficult. (And even if people have figured a way to do it, the fact remains that designing and implementing and proving the correctness of general purpose highly concurrent data structures and algorithms is hard.)

提交回复
热议问题