Is there any (well implemented) intrusive double linked list class(es) available for Java? Or should I do my own? Boost has it for C++: http://beta.boost.org/doc/libs/1_40_0/doc/html/boost/intrusive/list.html.
Intrusive list is a container having (in this case) next and prev pointers within element, so typical list operations like replace and remove can be directly targeted into elementary class instead of container class. There are some certain situations, where intrusive list are the best solution.
I try to give an appropriate example. Let's assume I have linked lists L list1 and L list2 owned by different type of classes X1 and Y2.
class Q (which has nothing to do or doesn't easily get access the interfaces of x1 and Y2 otherwise) needs to do i) replace, ii) remove operation for element e, which exists always in somewhere, in list1 xor list2 depending on run-time state, but that information is not stored directly anywhere.
With intrussive list Q can just store reference to an element to member element e and it always points the right place.
Otherwise you have to choose from several clearly more complex workarounds one or the other. - Wrapper class for element e and and additional methods for completing operations i and ii. No.
Basically, the question is still not about the performance but architectural complexity. This can also be understood as one kind of shared object situation where solution IL avoids the update need for every client Lx and Q.
Please notice I do NOT necessary need compatibility to other standard containers. Just an generic intrusive lsit implementation with an iterating, add, remove and find operations used with unknown element class.
Thanks.