qosamc.blogg.se

Kotlin linked list
Kotlin linked list













kotlin linked list

The list-iterator is fail-fast: if the list is structurally Obeys the general contract of List.listIterator(int). Sequence), starting at the specified position in the list. Returns a list-iterator of the elements in this list (in proper Therefore, it would be wrong to write a program that depended on thisĮxception for its correctness: the fail-fast behavior of iterators

kotlin linked list

Throw ConcurrentModificationException on a best-effort basis. Presence of unsynchronized concurrent modification.

kotlin linked list

Note that the fail-fast behavior of an iterator cannot be guaranteedĪs it is, generally speaking, impossible to make any hard guarantees in the Risking arbitrary, non-deterministic behavior at an undetermined Modification, the iterator fails quickly and cleanly, rather than Structurally modified at any time after the iterator is created, inĪny way except through the Iterator's own remove orĪdd methods, the iterator will throw a ConcurrentModificationException. ListIterator methods are fail-fast: if the list is The iterators returned by this class's iterator and List list = Collections.synchronizedList(new LinkedList(.)) This is best done at creation time, to prevent accidental If no such object exists, the list should be "wrapped" using the That adds or deletes one or more elements merely setting the value ofĪn element is not a structural modification.) This is typicallyĪccomplished by synchronizing on some object that naturally (A structural modification is any operation One of the threads modifies the list structurally, it must be If multiple threads access a linked list concurrently, and at least Note that this implementation is not synchronized. The beginning or the end, whichever is closer to the specified index. Operations that index into the list will traverse the list from Implements all optional list operations, and permits allĪll of the operations perform as could be expected for a doubly-linked Doubly-linked list implementation of the List and Deque















Kotlin linked list