#include <LinkedList.h>
Inheritance diagram for util::SortedLinkedList< content >:

Public Methods | |
| SortedLinkedList () | |
| Create an empty sorted linked list. | |
| SortedLinkedList (const content &data) | |
| Create an unlinked node with the given contents. | |
| SortedLinkedList * | addNode (SortedLinkedList *node) |
| Add a node to this linked list, maintaining sort order. | |
|
||||||||||
|
Add a node to this linked list, maintaining sort order. The list is seeked until a node with a content item not smaller than the provided one is found. The cardinality is checked using the < operator. The new node is inserted just before the found node, or to the end of the list if no applicable node cannot be found.
Using this method ensures that nodes are always sorted according to their contents. If you add nodes in any other way, the order cannot be guaranteed.
|