Dims
Dims

Reputation: 51209

How to simulate a pointer to LinkedList element in Java?

I need an object, that

I don't see proofs, that ListIterator complies these requirements. Particularly, I don't see it is Cloneable.

Upvotes: 0

Views: 41

Answers (2)

rcgldr
rcgldr

Reputation: 28921

java.util.LinkedList and it's iterators have limitations. Assigning an iterator only creates another reference to the same iterator object, so not "cloneable" assuming that's what you mean by "cloneable". If you create multiple iterators to a list, if any nodes are added or removed from a list, all iterators (except one used for add) will be invalidated. There's no equivalent of C++ std::list::splice(), which can move one or mode nodes within a list or from list to list.

Upvotes: 1

talex
talex

Reputation: 20544

There is no class that fulfill all the criteria for java.util.LinkedList. You need to implement your own linked list for that.

Upvotes: 1

Related Questions