The IntLinkedList
class provides a doubly-linked list for storing integers.
- Enum representing dummy elements at the head and tail.
HEAD
: Represents the dummy element at the head.TAIL
: Represents the dummy element at the tail.
- A doubly-linked list for storing integers.
- Initializes the linked list with the first and last dummy elements.
- Adds an item after a specified previous_item.
item (int)
: Item to add.previous_item (int, optional)
: Add item after this. Defaults to the dummy element at the head.
IntLinkedListException
: If the item already exists in this list or if previous_item does not exist in this list.
- Adds an item before a specified next_item.
item (int)
: Item to add.next_item (int, optional)
: Add item before this. Defaults to the dummy element at the tail.
IntLinkedListException
: If the item already exists in this list or if next_item does not exist in this list.
- Removes a specified item from the list.
item (int)
: Item to remove.
IntLinkedListException
: If Dummy.HEAD or Dummy.TAIL is specified or if item does not exist in this list.
- Converts the list to a Python list.
List[int]
: Python list containing items of the list.