LinkedList

List of singly-linked values

	Iterator iterator ()
        int opApply (int delegate(ref V value) dg)

        V head ()
        V tail ()
        V head (V value)
        V tail (V value)
        V removeHead ()
        V removeTail ()

        bool contains (V value)
        size_t first (V value, size_t startingIndex = 0)
        size_t last (V value, size_t startingIndex = 0)

        LinkedList add (V value)
        LinkedList prepend (V value)
        size_t prepend (IContainer!(V) e)
        LinkedList append (V value)
        size_t append (IContainer!(V) e)
        LinkedList addAt (size_t index, V value)
        size_t addAt (size_t index, IContainer!(V) e)

        V get (size_t index)
        bool take (ref V v)
        size_t remove (V value, bool all)
        bool removeAt (size_t index)
        size_t removeRange (size_t fromIndex, size_t toIndex)
        size_t replace (V oldElement, V newElement, bool all)
        bool replaceAt (size_t index, V value)

        LinkedList clear ()
        LinkedList reset ()

        LinkedList subset (size_t from, size_t length = size_t.max)
        LinkedList dup ()

        size_t size ()
        bool isEmpty ()
        V[] toArray (V[] dst)
        LinkedList sort (Compare!(V) cmp)
        LinkedList check ()

Constructors

this
this()

Create a new empty list

this
this(Ref l, size_t c)

Special version of constructor needed by dup

Destructor

~this
~this()

Clean up when deleted

Members

Functions

add
LinkedList add(V value)

Time complexity: O(1)

addAt
LinkedList addAt(size_t index, V value)

Time complexity: O(n)

addAt
size_t addAt(size_t index, IContainer!(V) e)

Time complexity: O(n + number of elements in e)

append
LinkedList append(V value)

Time complexity: O(n)

append
size_t append(IContainer!(V) e)

Time complexity: O(n + number of elements in e)

cache
LinkedList cache(size_t chunk, size_t count)

Configure the assigned allocator with the size of each allocation block (number of nodes allocated at one time) and the number of nodes to pre-populate the cache with.

check
LinkedList check()
clear
LinkedList clear()

Time complexity: O(n)

contains
bool contains(V value)

Time complexity: O(n)

dup
LinkedList dup()

Build an independent copy of the list. The elements themselves are not cloned

first
size_t first(V value, size_t startingIndex)

Time complexity: O(n) Returns size_t.max if no element found.

get
V get(size_t index)

Time complexity: O(n)

head
V head()

Time complexity: O(1)

head
V head(V value)

Time complexity: O(1)

isEmpty
bool isEmpty()

Is this container empty?

iterator
Iterator iterator()

Return a generic iterator for contained elements

last
size_t last(V value, size_t startingIndex)

Time complexity: O(n) Returns size_t.max if no element found.

opApply
int opApply(int delegate(ref V value) dg)
prepend
LinkedList prepend(V value)

Time complexity: O(1)

prepend
size_t prepend(IContainer!(V) e)

Time complexity: O(number of elements in e)

remove
size_t remove(V value, bool all)

Time complexity: O(n)

removeAt
LinkedList removeAt(size_t index)

Time complexity: O(n)

removeHead
V removeHead()

Time complexity: O(1)

removeRange
size_t removeRange(size_t fromIndex, size_t toIndex)

Time complexity: O(n)

removeTail
V removeTail()

Time complexity: O(n)

replace
size_t replace(V oldElement, V newElement, bool all)

Time complexity: O(n)

replaceAt
LinkedList replaceAt(size_t index, V value)

Time complexity: O(n)

reset
LinkedList reset()

Reset the HashMap contents and optionally configure a new heap manager. We cannot guarantee to clean up reconfigured allocators, so be sure to invoke reset() before discarding this class

size
size_t size()

Return the number of elements contained

sort
LinkedList sort(Compare!(V) cmp)

Uses a merge-sort-based algorithm.

subset
LinkedList subset(size_t from, size_t length)

Time complexity: O(length)

tail
V tail()

Time complexity: O(n)

tail
V tail(V value)

Time complexity: O(n)

take
bool take(V v)

Takes the first value on the list

toArray
V[] toArray(V[] dst)

Copy and return the contained set of values in an array, using the optional dst as a recipient (which is resized as necessary).

Meta