Interface IntrusiveLinkedList
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
IntrusiveLinkedListImpl
An intrusive linked list where the "next" pointer is stored within the element's memory.
This avoids allocating a Node wrapper for every element. The element is represented by a MemorySegment (or an offset within a segment).
-
Method Details
-
add
Adds an element to the tail of the list.- Parameters:
segment- The memory segment representing the element.
-
poll
MemorySegment poll()Removes and returns the head of the list.- Returns:
- The memory segment of the head, or null if empty.
-
size
int size() -
isEmpty
boolean isEmpty() -
close
void close()- Specified by:
closein interfaceAutoCloseable
-