Interface IntrusiveLinkedList

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
IntrusiveLinkedListImpl

public interface IntrusiveLinkedList extends AutoCloseable
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 Summary

    Modifier and Type
    Method
    Description
    void
    add(MemorySegment segment)
    Adds an element to the tail of the list.
    void
     
    boolean
     
    Removes and returns the head of the list.
    int
     
  • Method Details

    • add

      void add(MemorySegment segment)
      Adds an element to the tail of the list.
      Parameters:
      segment - The memory segment representing the element.
    • 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:
      close in interface AutoCloseable