class documentation
A double linkked list used by the LRU cache.
| Method | __init__ |
The default constructor. |
| Method | __iter__ |
Iterate over the values in this list. |
| Method | __repr__ |
Return a string representing this object |
| Method | append |
Append an element to the end of this list. |
| Method | clear |
Empty this list. |
| Method | iter |
Iterate over all values. |
| Method | prepend |
Prepend an element at the front of this list. |
| Method | remove |
Remove a list element (not a value!). |
| Method | remove |
Remove the first element of this list. |
| Method | remove |
Remove the last element of this list. |
| Method | to |
Return a python list of the values in this list. |
| Instance Variable | head |
the first element in this list |
| Instance Variable | length |
current length of list |
| Instance Variable | tail |
the last element in this list |
The default constructor.
| Parameters | |
elements:iterator or None | if specified, add all elements from this iterable to this list |
Append an element to the end of this list.
If value if a _DoubleLinkedListElement, it will not be wrapped and instead used directly.
Complexity is O(1).
| Parameters | |
| value:any | value or element to append |
| Returns | |
_DoubleLinkedListElement | the added list element |
Prepend an element at the front of this list.
If value if a _DoubleLinkedListElement, it will not be wrapped and instead used directly.
Complexity is O(1).
| Parameters | |
| value:any | value or element to prepend |
| Returns | |
_DoubleLinkedListElement | the added list element |
Remove a list element (not a value!).
Complexity is O(1).
| Parameters | |
element:_DoubleLinkedListElement | element to remove |
| Raises | |
ValueError | if element is not part of this list |
Remove the first element of this list.
Complexity is O(1).
| Raises | |
IndexError | if there is no first element |
Remove the last element of this list.
Complexity is O(1).
| Raises | |
IndexError | if there is no last element |
Return a python list of the values in this list.
Complexity is O(n).
| Returns | |
list | a list containing the values in this list |