Java equivalent of std::deque

前端 未结 4 1809
执念已碎
执念已碎 2020-12-10 13:36

I\'m a relatively new Java programmer coming from C++/STL, and am looking for a class with these characteristics (which the C++ std::deque has, as I understand it):

4条回答
  •  轮回少年
    2020-12-10 14:21

    Here is a ready-to-use circular buffer implemented in Java, CircularArrayList. It isn't growable after creation, though. (Disclaimer: This link points to my own website)

    The other option floating around the web would be the one from the Java Specialists Newsletter. I never used that one, for the following reasons:

    1. It is incomplete - ("This method left as an exercise to the reader")
    2. It does not support generic element type as would have been consistent with other collections from the Java Collection's Framework.
    3. It is unnecessarily complicated, and therefore possibly buggy, instead of following the extension procedure recommended by AbstractList's Javadoc.

提交回复
热议问题