ListNode¶
Inherits: Object
A single element in the LinkedList.
Description¶
The list node is an elemental building block which represent the entire structure of LinkedLists. It has next and prev properties which are assigned whenever a new element is inserted into the list, such as using LinkedList.push_back.
Warning: do not use Object.free to remove this node from the list it belongs to (unless it is instantiated manually with ListNode.new()
), call erase instead which allows the list to update neighbor node references as well.
Property Descriptions¶
- ListNode next
Getter | get_next() |
The next node this node points to in the LinkedList. If null
, then this node is the last element in the list, which is equivalent to LinkedList.back.
- ListNode prev
Getter | get_prev() |
The previous node this node points to in the LinkedList. If null
, then this node is the first element in the list, which is equivalent to LinkedList.front.
- Variant value
Setter | set_value(value) |
Getter | get_value() |
The data this node holds, usually initialized with the list methods such as LinkedList.push_back. Can be anything, including other LinkedLists.