C5  2.4
The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on .NET 3.5+, Silverlight 5, Windows Phone 8, Xamarin.iOS, Xamarin.Android, and Mono.
C5.LinkedList< T > Class Template Reference

A list collection class based on a doubly linked list data structure. More...

Inheritance diagram for C5.LinkedList< T >:
C5.SequencedBase< T > C5.IList< T > C5.IStack< T > C5.IQueue< T > C5.IDirectedCollectionValue< T > C5.IDirectedCollectionValue< T > C5.IIndexed< T > C5.IDirectedCollectionValue< T > C5.DirectedCollectionBase< T >

Public Member Functions

 LinkedList (SCG.IEqualityComparer< T > itemequalityComparer)
 Create a linked list with en external item equalityComparer More...
 
 LinkedList ()
 Create a linked list with the natural item equalityComparer More...
 
virtual void Dispose ()
 Invalidate this list. If a view, just invalidate the view. If not a view, invalidate the list and all views on it. More...
 
virtual void Insert (int i, T item)
 Insert an item at a specific index location in this list.

Exceptions
IndexOutOfRangeExceptionif i is negative or > the size of the collection.
More...
 
void Insert (IList< T > pointer, T item)
 Insert an item at the end of a compatible view, used as a pointer. More...
 
virtual void InsertAll (int i, SCG.IEnumerable< T > items)
 Insert into this list all items from an enumerable collection starting at a particular index.

Exceptions
IndexOutOfRangeExceptionif i is negative or > the size of the collection.
More...
 
virtual void InsertFirst (T item)
 Insert an item at the front of this list. More...
 
virtual void InsertLast (T item)
 Insert an item at the back of this list. More...
 
IList< V > Map< V > (Func< T, V > mapper)
 Create a new list consisting of the results of mapping all items of this list. More...
 
IList< V > Map< V > (Func< T, V > mapper, SCG.IEqualityComparer< V > equalityComparer)
 Create a new list consisting of the results of mapping all items of this list. The new list will use a specified equalityComparer for the item type. More...
 
virtual T Remove ()
 Remove one item from the list: from the front if More...
 
virtual T RemoveFirst ()
 Remove one item from the front of the list.

Exceptions
NoSuchItemExceptionif this list is empty.
More...
 
virtual T RemoveLast ()
 Remove one item from the back of the list.

Exceptions
NoSuchItemExceptionif this list is empty.
More...
 
virtual IList< T > View (int start, int count)
 Create a list view on this list. More...
 
virtual IList< T > ViewOf (T item)
 Create a list view on this list containing the (first) occurrence of a particular item. More...
 
virtual IList< T > LastViewOf (T item)
 Create a list view on this list containing the last occurrence of a particular item.

Exceptions
ArgumentExceptionif the item is not in this list.
More...
 
IList< T > Slide (int offset)
 Slide this list view along the underlying list. More...
 
IList< T > Slide (int offset, int size)
 Slide this list view along the underlying list, perhaps changing its size. More...
 
virtual bool TrySlide (int offset)
 
virtual bool TrySlide (int offset, int size)
 
virtual IList< T > Span (IList< T > otherView)
 
virtual void Reverse ()
 Reverse the list so the items are in the opposite sequence order. More...
 
bool IsSorted ()
 Check if this list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class More...
 
virtual bool IsSorted (SCG.IComparer< T > c)
 Check if this list is sorted according to a specific sorting order. More...
 
virtual void Sort ()
 Sort the items of the list according to the default sorting order for the item type T, as defined by the Comparer[T] class. (T:C5.Comparer`1). The sorting is stable. More...
 
virtual void Sort (SCG.IComparer< T > c)
 Sort the items of the list according to a specific sorting order. The sorting is stable. More...
 
virtual void Shuffle ()
 Randomly shuffle the items of this list. More...
 
virtual void Shuffle (Random rnd)
 Shuffle the items of this list according to a specific random source. More...
 
virtual int IndexOf (T item)
 Searches for an item in the list going forwards from the start. More...
 
virtual int LastIndexOf (T item)
 Searches for an item in the list going backwards from the end. More...
 
virtual T RemoveAt (int i)
 Remove the item at a specific position of the list.

Exceptions
IndexOutOfRangeExceptionif i is negative or >= the size of the collection.
More...
 
virtual void RemoveInterval (int start, int count)
 Remove all items in an index interval.

Exceptions
IndexOutOfRangeException???.
More...
 
override int GetSequencedHashCode ()
 
override bool SequencedEquals (ISequenced< T > that)
 
override IDirectedCollectionValue< T > Backwards ()
 Create a collection containing the same items as this collection, but whose enumerator will enumerate the items backwards. The new collection will become invalid if the original is modified. Method typically used as in More...
 
override int GetUnsequencedHashCode ()
 Performs a check for view validity before calling base.GetUnsequencedHashCode() More...
 
override bool UnsequencedEquals (ICollection< T > that)
 
virtual bool Contains (T item)
 Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value. More...
 
virtual bool Find (ref T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. More...
 
virtual bool Update (T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value. Will update a single item. More...
 
virtual bool Update (T item, out T olditem)
 
virtual bool FindOrAdd (ref T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. Else, add the item to the collection. More...
 
virtual bool UpdateOrAdd (T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection. More...
 
virtual bool UpdateOrAdd (T item, out T olditem)
 
virtual bool Remove (T item)
 Remove a particular item from this collection. Since the collection has bag semantics only one copy equivalent to the supplied item is removed. More...
 
virtual bool Remove (T item, out T removeditem)
 Remove a particular item from this collection if found (only one copy). If an item was removed, report a binary copy of the actual item removed in the argument. More...
 
virtual void RemoveAll (SCG.IEnumerable< T > items)
 Remove all items in another collection from this one, taking multiplicities into account. More...
 
virtual void Clear ()
 Remove all items from this collection. More...
 
virtual void RetainAll (SCG.IEnumerable< T > items)
 Remove all items not in some other collection from this one, taking multiplicities into account. More...
 
virtual bool ContainsAll (SCG.IEnumerable< T > items)
 Check if this collection contains all the values in another collection with respect to multiplicities. More...
 
IList< T > FindAll (Func< T, bool > filter)
 Create a new list consisting of the items of this list satisfying a certain predicate. More...
 
virtual int ContainsCount (T item)
 Count the number of items of the collection equal to a particular value. Returns 0 if and only if the value is not in the collection. More...
 
virtual ICollectionValue< T > UniqueItems ()
 
virtual ICollectionValue< KeyValuePair< T, int > > ItemMultiplicities ()
 
virtual void RemoveAllCopies (T item)
 Remove all items equivalent to a given value. More...
 
override T Choose ()
 Choose some item of this collection. More...
 
override SCG.IEnumerable< T > Filter (Func< T, bool > filter)
 Create an enumerable, enumerating the items of this collection that satisfies a certain condition. More...
 
override SCG.IEnumerator< T > GetEnumerator ()
 Create an enumerator for the collection More...
 
virtual bool Add (T item)
 Add an item to this collection if possible. More...
 
virtual void AddAll (SCG.IEnumerable< T > items)
 Add the elements from another collection with a more specialized item type to this collection. More...
 
void Push (T item)
 Push an item to the top of the stack. More...
 
Pop ()
 Pop the item at the top of the stack from the stack. More...
 
virtual void Enqueue (T item)
 Enqueue an item at the back of the queue. More...
 
virtual T Dequeue ()
 Dequeue an item from the front of the queue. More...
 
virtual bool Check ()
 Check the sanity of this list More...
 
- Public Member Functions inherited from C5.SequencedBase< T >
int FindIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one. More...
 
int FindLastIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one. More...
 
- Public Member Functions inherited from C5.DirectedCollectionBase< T >
virtual bool FindLast (Func< T, bool > predicate, out T item)
 Check if there exists an item that satisfies a specific predicate in this collection and return the first one in enumeration order. More...
 
- Public Member Functions inherited from C5.CollectionValueBase< T >
virtual void CopyTo (T[] array, int index)
 Copy the items of this collection to part of an array. More...
 
virtual T[] ToArray ()
 Create an array with the items of this collection (in the same order as an enumerator would output them). More...
 
virtual void Apply (Action< T > action)
 Apply an single argument action, T:Action`1 to this enumerable More...
 
virtual bool Exists (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection. More...
 
virtual bool Find (Func< T, bool > predicate, out T item)
 Check if there exists an item that satisfies a specific predicate in this collection and return the first one in enumeration order. More...
 
virtual bool All (Func< T, bool > predicate)
 Check if all items in this collection satisfies a specific predicate. More...
 
virtual bool Show (System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 
virtual string ToString (string format, IFormatProvider formatProvider)
 
override string ToString ()
 
- Public Member Functions inherited from C5.IShowable
bool Show (StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 Format More...
 
- Public Member Functions inherited from C5.IList< T >
new void CopyTo (T[] array, int index)
 
- Public Member Functions inherited from C5.IIndexed< T >
int FindIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one. More...
 
int FindLastIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one. More...
 

Protected Member Functions

override void updatecheck ()
 Check if it is valid to perform updates and increment stamp of underlying if this is a view. More...
 
override void modifycheck (int stamp)
 Check that the list has not been updated since a particular time. More...
 
- Protected Member Functions inherited from C5.SequencedBase< T >
 SequencedBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
- Protected Member Functions inherited from C5.DirectedCollectionBase< T >
 DirectedCollectionBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
- Protected Member Functions inherited from C5.CollectionBase< T >
 CollectionBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
void checkRange (int start, int count)
 Utility method for range checking. More...
 
- Protected Member Functions inherited from C5.CollectionValueBase< T >
virtual void raiseCollectionChanged ()
 Fire the CollectionChanged event More...
 
virtual void raiseCollectionCleared (bool full, int count)
 Fire the CollectionCleared event More...
 
virtual void raiseCollectionCleared (bool full, int count, int?offset)
 Fire the CollectionCleared event More...
 
virtual void raiseItemsAdded (T item, int count)
 Fire the ItemsAdded event More...
 
virtual void raiseItemsRemoved (T item, int count)
 Fire the ItemsRemoved event More...
 
virtual void raiseItemInserted (T item, int index)
 Fire the ItemInserted event More...
 
virtual void raiseItemRemovedAt (T item, int index)
 Fire the ItemRemovedAt event More...
 
virtual void raiseForSetThis (int index, T value, T item)
 
virtual void raiseForInsert (int i, T item)
 
void raiseForRemove (T item)
 
void raiseForRemove (T item, int count)
 
void raiseForRemoveAt (int index, T item)
 
virtual void raiseForUpdate (T newitem, T olditem)
 
virtual void raiseForUpdate (T newitem, T olditem, int count)
 
virtual void raiseForAdd (T item)
 
virtual void raiseForRemoveAll (ICollectionValue< T > wasRemoved)
 

Properties

override EventTypeEnum ListenableEvents [get]
 
virtual T First [get]
 
virtual T Last [get]
 
virtual bool FIFO [get, set]
 Since More...
 
virtual bool IsFixedSize [get]
 
virtual T this[int index] [get, set]
 On this list, this indexer is read/write.

Exceptions
IndexOutOfRangeExceptionif i is negative or >= the size of the collection.
More...
 
virtual Speed IndexingSpeed [get]
 
virtual IList< T > Underlying [get]
 Null if this list is not a view. More...
 
virtual bool IsValid [get]
 
virtual int Offset [get]
 
IDirectedCollectionValue< T > this[int start, int count] [get]
 
Exceptions
IndexOutOfRangeException.
More...
 
virtual Speed ContainsSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
override int Count [get]
 
virtual bool AllowsDuplicates [get]
 
virtual bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
- Properties inherited from C5.SequencedBase< T >
override EnumerationDirection Direction [get]
 
- Properties inherited from C5.DirectedCollectionBase< T >
virtual EnumerationDirection Direction [get]
 
- Properties inherited from C5.CollectionBase< T >
virtual bool IsReadOnly [get]
 
override int Count [get]
 
override Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
virtual SCG.IEqualityComparer< T > EqualityComparer [get]
 
override bool IsEmpty [get]
 
- Properties inherited from C5.CollectionValueBase< T >
virtual EventTypeEnum ListenableEvents [get]
 
virtual EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
virtual CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
virtual CollectionClearedHandler< T > CollectionCleared
 The clear event. Will be raised for every Clear operation on the collection. More...
 
virtual ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
virtual ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
virtual ItemInsertedHandler< T > ItemInserted
 The item added event. Will be raised for every individual addition to the collection. More...
 
virtual ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed event. Will be raised for every individual removal from the collection. More...
 
abstract bool IsEmpty [get]
 Check if collection is empty. More...
 
abstract int Count [get]
 The number of items in this collection. More...
 
abstract Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.ICollectionValue< T >
EventTypeEnum ListenableEvents [get]
 A flag bitmap of the events subscribable to by this collection. More...
 
EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
bool IsEmpty [get]
 
int Count [get]
 
Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.IDirectedEnumerable< T >
EnumerationDirection Direction [get]
 
- Properties inherited from C5.IList< T >
First [get]
 
Last [get]
 
bool FIFO [get, set]
 Since More...
 
bool IsFixedSize [get]
 
new T this[int index] [get, set]
 On this list, this indexer is read/write. More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 
IList< T > Underlying [get]
 Null if this list is not a view. More...
 
int Offset [get]
 
bool IsValid [get]
 
- Properties inherited from C5.IIndexed< T >
Speed IndexingSpeed [get]
 
IDirectedCollectionValue< T > this[int start, int count] [get]
 
- Properties inherited from C5.ICollection< T >
Speed ContainsSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
- Properties inherited from C5.IExtensible< T >
bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
bool AllowsDuplicates [get]
 
SCG.IEqualityComparer< T > EqualityComparer [get]
 (Here should be a discussion of the role of equalityComparers. Any ). More...
 
bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
- Properties inherited from C5.IStack< T >
bool AllowsDuplicates [get]
 
this[int index] [get]
 Get the More...
 
- Properties inherited from C5.IQueue< T >
bool AllowsDuplicates [get]
 
this[int index] [get]
 Get the More...
 

Additional Inherited Members

- Static Public Member Functions inherited from C5.SequencedBase< T >
static int ComputeHashCode (ISequenced< T > items, SCG.IEqualityComparer< T > itemequalityComparer)
 Compute the unsequenced hash code of a collection More...
 
static bool StaticEquals (ISequenced< T > collection1, ISequenced< T > collection2, SCG.IEqualityComparer< T > itemequalityComparer)
 Examine if tit and tat are equal as sequenced collections using the specified item equalityComparer (assumed compatible with the two collections). More...
 
- Static Public Member Functions inherited from C5.CollectionBase< T >
static int ComputeHashCode (ICollectionValue< T > items, SCG.IEqualityComparer< T > itemequalityComparer)
 Compute the unsequenced hash code of a collection More...
 
static bool StaticEquals (ICollection< T > collection1, ICollection< T > collection2, SCG.IEqualityComparer< T > itemequalityComparer)
 Examine if collection1 and collection2 are equal as unsequenced collections using the specified item equalityComparer (assumed compatible with the two collections). More...
 
- Static Protected Member Functions inherited from C5.EnumerableBase< T >
static int countItems (SCG.IEnumerable< T > items)
 Count the number of items in an enumerable by enumeration More...
 
- Protected Attributes inherited from C5.CollectionBase< T >
bool isReadOnlyBase = false
 The underlying field of the ReadOnly property More...
 
int stamp
 The current stamp value More...
 
int size
 The number of items in the collection More...
 
readonly SCG.IEqualityComparer< T > itemequalityComparer
 The item equalityComparer of the collection More...
 
- Events inherited from C5.ICollectionValue< T >
CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
CollectionClearedHandler< T > CollectionCleared
 The change event. Will be raised for every clear operation on the collection. More...
 
ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemInsertedHandler< T > ItemInserted
 The item inserted event. Will be raised for every individual insertion to the collection. More...
 
ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed at event. Will be raised for every individual removal at from the collection. More...
 

Detailed Description

A list collection class based on a doubly linked list data structure.

Constructor & Destructor Documentation

C5.LinkedList< T >.LinkedList ( SCG.IEqualityComparer< T >  itemequalityComparer)

Create a linked list with en external item equalityComparer

Parameters
itemequalityComparerThe external equalitySCG.Comparer

Create a linked list with the natural item equalityComparer

Member Function Documentation

virtual bool C5.LinkedList< T >.Add ( item)
virtual

Add an item to this collection if possible.

Parameters
itemThe item to add.
Returns
True.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.AddAll ( SCG.IEnumerable< T >  items)
virtual

Add the elements from another collection with a more specialized item type to this collection.

Parameters
itemsThe items to add

Implements C5.IExtensible< T >.

override IDirectedCollectionValue<T> C5.LinkedList< T >.Backwards ( )
virtual

Create a collection containing the same items as this collection, but whose enumerator will enumerate the items backwards. The new collection will become invalid if the original is modified. Method typically used as in

foreach (T x in coll.Backwards()) {...}

Returns
The backwards collection.

Implements C5.DirectedCollectionBase< T >.

virtual bool C5.LinkedList< T >.Check ( )
virtual

Check the sanity of this list

Returns
true if sane

Implements C5.IExtensible< T >.

override T C5.LinkedList< T >.Choose ( )

Choose some item of this collection.

Exceptions
NoSuchItemExceptionif collection is empty.
Returns

Implements C5.ICollectionValue< T >.

virtual void C5.LinkedList< T >.Clear ( )
virtual

Remove all items from this collection.

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.Contains ( item)
virtual

Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value.

Parameters
itemThe value to check for.
Returns
True if the items is in this collection.

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.ContainsAll ( SCG.IEnumerable< T >  items)
virtual

Check if this collection contains all the values in another collection with respect to multiplicities.

Parameters
itemsThe
Returns
True if all values in
items
is in this collection.

Implements C5.ICollection< T >.

virtual int C5.LinkedList< T >.ContainsCount ( item)
virtual

Count the number of items of the collection equal to a particular value. Returns 0 if and only if the value is not in the collection.

Parameters
itemThe value to count.
Returns
The number of copies found.

Implements C5.ICollection< T >.

virtual T C5.LinkedList< T >.Dequeue ( )
virtual

Dequeue an item from the front of the queue.

Returns
The item

Implements C5.IQueue< T >.

virtual void C5.LinkedList< T >.Dispose ( )
virtual

Invalidate this list. If a view, just invalidate the view. If not a view, invalidate the list and all views on it.

virtual void C5.LinkedList< T >.Enqueue ( item)
virtual

Enqueue an item at the back of the queue.

Parameters
itemThe item

Implements C5.IQueue< T >.

override SCG.IEnumerable<T> C5.LinkedList< T >.Filter ( Func< T, bool >  filter)

Create an enumerable, enumerating the items of this collection that satisfies a certain condition.

Parameters
filterThe T->bool filter delegate defining the condition
Returns
The filtered enumerable

Implements C5.ICollectionValue< T >.

virtual bool C5.LinkedList< T >.Find ( ref T  item)
virtual

Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found.

Parameters
itemThe value to look for.
Returns
True if the items is in this collection.

Implements C5.ICollection< T >.

IList<T> C5.LinkedList< T >.FindAll ( Func< T, bool >  filter)

Create a new list consisting of the items of this list satisfying a certain predicate.

Parameters
filterThe filter delegate defining the predicate.
Returns
The new list.

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.FindOrAdd ( ref T  item)
virtual

Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. Else, add the item to the collection.

Parameters
itemThe value to look for.
Returns
True if the item was found (hence not added).

Implements C5.ICollection< T >.

override SCG.IEnumerator<T> C5.LinkedList< T >.GetEnumerator ( )
virtual

Create an enumerator for the collection

Returns
The enumerator

Implements C5.SequencedBase< T >.

override int C5.LinkedList< T >.GetSequencedHashCode ( )
virtual

Returns

Reimplemented from C5.SequencedBase< T >.

override int C5.LinkedList< T >.GetUnsequencedHashCode ( )
virtual

Performs a check for view validity before calling base.GetUnsequencedHashCode()

Returns

Reimplemented from C5.CollectionBase< T >.

virtual int C5.LinkedList< T >.IndexOf ( item)
virtual

Searches for an item in the list going forwards from the start.

Parameters
itemItem to search for.
Returns
Index of item from start.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.Insert ( int  i,
item 
)
virtual

Insert an item at a specific index location in this list.

Exceptions
IndexOutOfRangeExceptionif i is negative or > the size of the collection.

Parameters
iThe index at which to insert.
itemThe item to insert.
void C5.LinkedList< T >.Insert ( IList< T >  pointer,
item 
)

Insert an item at the end of a compatible view, used as a pointer.

The pointer must be a view on the same list as this and the endpoint of pointer must be a valid insertion point of this

Exceptions
IncompatibleViewExceptionIf
pointer
is not a view on the same list as
this
IndexOutOfRangeException?????? if the endpoint of
pointer
is not inside
this
DuplicateNotAllowedExceptionif the list has and the item is already in the list.
Parameters
pointer
item

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.InsertAll ( int  i,
SCG.IEnumerable< T >  items 
)
virtual

Insert into this list all items from an enumerable collection starting at a particular index.

Exceptions
IndexOutOfRangeExceptionif i is negative or > the size of the collection.

Parameters
iIndex to start inserting at
itemsItems to insert

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.InsertFirst ( item)
virtual

Insert an item at the front of this list.

Parameters
itemThe item to insert.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.InsertLast ( item)
virtual

Insert an item at the back of this list.

Parameters
itemThe item to insert.

Implements C5.IList< T >.

bool C5.LinkedList< T >.IsSorted ( )

Check if this list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class

Exceptions
NotComparableExceptionif T is not comparable
Returns
True if the list is sorted, else false.

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.IsSorted ( SCG.IComparer< T >  c)
virtual

Check if this list is sorted according to a specific sorting order.

Parameters
cThe comparer defining the sorting order.
Returns
True if the list is sorted, else false.

Implements C5.IList< T >.

virtual ICollectionValue<KeyValuePair<T, int> > C5.LinkedList< T >.ItemMultiplicities ( )
virtual

Returns

Implements C5.ICollection< T >.

virtual int C5.LinkedList< T >.LastIndexOf ( item)
virtual

Searches for an item in the list going backwards from the end.

Parameters
itemItem to search for.
Returns
Index of of item from the end.

Implements C5.IIndexed< T >.

virtual IList<T> C5.LinkedList< T >.LastViewOf ( item)
virtual

Create a list view on this list containing the last occurrence of a particular item.

Exceptions
ArgumentExceptionif the item is not in this list.

Parameters
itemThe item to find.
Returns
The new list view.

Implements C5.IList< T >.

IList<V> C5.LinkedList< T >.Map< V > ( Func< T, V >  mapper)

Create a new list consisting of the results of mapping all items of this list.

Parameters
mapperThe delegate defining the map.
Returns
The new list.

Implements C5.IList< T >.

IList<V> C5.LinkedList< T >.Map< V > ( Func< T, V >  mapper,
SCG.IEqualityComparer< V >  equalityComparer 
)

Create a new list consisting of the results of mapping all items of this list. The new list will use a specified equalityComparer for the item type.

Template Parameters
VThe type of items of the new list
Parameters
mapperThe delegate defining the map.
equalityComparerThe equalityComparer to use for the new list
Returns
The new list.

Implements C5.IList< T >.

override void C5.LinkedList< T >.modifycheck ( int  stamp)
protectedvirtual

Check that the list has not been updated since a particular time.

Parameters
stampThe stamp indicating the time.
Exceptions
CollectionModifiedExceptionif check fails.

Reimplemented from C5.CollectionBase< T >.

T C5.LinkedList< T >.Pop ( )

Pop the item at the top of the stack from the stack.

Returns
The popped item.

Implements C5.IStack< T >.

void C5.LinkedList< T >.Push ( item)

Push an item to the top of the stack.

Parameters
itemThe item

Implements C5.IStack< T >.

virtual T C5.LinkedList< T >.Remove ( )
virtual

Remove one item from the list: from the front if

FIFO is true, else from the back.

Exceptions
NoSuchItemExceptionif this list is empty.
Returns
The removed item.

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.Remove ( item)
virtual

Remove a particular item from this collection. Since the collection has bag semantics only one copy equivalent to the supplied item is removed.

Parameters
itemThe value to remove.
Returns
True if the item was found (and removed).

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.Remove ( item,
out T  removeditem 
)
virtual

Remove a particular item from this collection if found (only one copy). If an item was removed, report a binary copy of the actual item removed in the argument.

Parameters
itemThe value to remove on input.
removeditemThe value removed.
Returns
True if the item was found (and removed).

Implements C5.ICollection< T >.

virtual void C5.LinkedList< T >.RemoveAll ( SCG.IEnumerable< T >  items)
virtual

Remove all items in another collection from this one, taking multiplicities into account.

Always removes from the front of the list.

The asymptotic running time complexity of this method is O(n+m+v*log(v)), where n is the size of this list, m is the size of the items collection and v is the number of views. The method will temporarily allocate memory of size O(m+v).

Parameters
itemsThe items to remove.

Implements C5.ICollection< T >.

virtual void C5.LinkedList< T >.RemoveAllCopies ( item)
virtual

Remove all items equivalent to a given value.

The asymptotic complexity of this method is O(n+v*log(v)), where n is the size of the collection and v is the number of views.

Parameters
itemThe value to remove.

Implements C5.ICollection< T >.

virtual T C5.LinkedList< T >.RemoveAt ( int  i)
virtual

Remove the item at a specific position of the list.

Exceptions
IndexOutOfRangeExceptionif i is negative or >= the size of the collection.

Parameters
iThe index of the item to remove.
Returns
The removed item.

Implements C5.IList< T >.

virtual T C5.LinkedList< T >.RemoveFirst ( )
virtual

Remove one item from the front of the list.

Exceptions
NoSuchItemExceptionif this list is empty.

Returns
The removed item.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.RemoveInterval ( int  start,
int  count 
)
virtual

Remove all items in an index interval.

Exceptions
IndexOutOfRangeException???.

Parameters
startThe index of the first item to remove.
countThe number of items to remove.

Implements C5.IIndexed< T >.

virtual T C5.LinkedList< T >.RemoveLast ( )
virtual

Remove one item from the back of the list.

Exceptions
NoSuchItemExceptionif this list is empty.

Returns
The removed item.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.RetainAll ( SCG.IEnumerable< T >  items)
virtual

Remove all items not in some other collection from this one, taking multiplicities into account.

The asymptotic running time complexity of this method is O(n+m+v*log(v)), where n is the size of this collection, m is the size of the items collection and v is the number of views. The method will temporarily allocate memory of size O(m+v). The stated complexity holds under the assumption that the itemequalityComparer of this list is well-behaved.

Parameters
itemsThe items to retain.

Implements C5.ICollection< T >.

virtual void C5.LinkedList< T >.Reverse ( )
virtual

Reverse the list so the items are in the opposite sequence order.

Implements C5.IList< T >.

override bool C5.LinkedList< T >.SequencedEquals ( ISequenced< T >  that)
virtual

Parameters
that
Returns

Reimplemented from C5.SequencedBase< T >.

virtual void C5.LinkedList< T >.Shuffle ( )
virtual

Randomly shuffle the items of this list.

Will invalidate overlapping views???

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.Shuffle ( Random  rnd)
virtual

Shuffle the items of this list according to a specific random source.

Will invalidate overlapping views???

Parameters
rndThe random source.

Implements C5.IList< T >.

IList<T> C5.LinkedList< T >.Slide ( int  offset)

Slide this list view along the underlying list.

Exceptions
NotAViewExceptionif this list is not a view.
ArgumentOutOfRangeExceptionif the operation would bring either end of the view outside the underlying list.
Parameters
offsetThe signed amount to slide: positive to slide towards the end.

Implements C5.IList< T >.

IList<T> C5.LinkedList< T >.Slide ( int  offset,
int  size 
)

Slide this list view along the underlying list, perhaps changing its size.

Exceptions
NotAViewExceptionif this list is not a view.
ArgumentOutOfRangeExceptionif the operation would bring either end of the view outside the underlying list.
Parameters
offsetThe signed amount to slide: positive to slide towards the end.
sizeThe new size of the view.

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.Sort ( )
virtual

Sort the items of the list according to the default sorting order for the item type T, as defined by the Comparer[T] class. (T:C5.Comparer`1). The sorting is stable.

Exceptions
InvalidOperationExceptionif T is not comparable

Implements C5.IList< T >.

virtual void C5.LinkedList< T >.Sort ( SCG.IComparer< T >  c)
virtual

Sort the items of the list according to a specific sorting order. The sorting is stable.

Parameters
cThe comparer defining the sorting order.

Implements C5.IList< T >.

virtual IList<T> C5.LinkedList< T >.Span ( IList< T >  otherView)
virtual

Returns null if otherView is strictly to the left of this view

Parameters
otherView
Exceptions
IncompatibleViewExceptionIf otherView does not have the same underlying list as this
Returns

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.TrySlide ( int  offset)
virtual

Parameters
offset
Returns

Implements C5.IList< T >.

virtual bool C5.LinkedList< T >.TrySlide ( int  offset,
int  size 
)
virtual

Parameters
offset
size
Returns

Implements C5.IList< T >.

virtual ICollectionValue<T> C5.LinkedList< T >.UniqueItems ( )
virtual

Returns

Implements C5.ICollection< T >.

override bool C5.LinkedList< T >.UnsequencedEquals ( ICollection< T >  that)
virtual

Parameters
that
Returns

Reimplemented from C5.CollectionBase< T >.

virtual bool C5.LinkedList< T >.Update ( item)
virtual

Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value. Will update a single item.

Parameters
itemValue to update.
Returns
True if the item was found and hence updated.

Implements C5.ICollection< T >.

virtual bool C5.LinkedList< T >.Update ( item,
out T  olditem 
)
virtual

Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

override void C5.LinkedList< T >.updatecheck ( )
protectedvirtual

Check if it is valid to perform updates and increment stamp of underlying if this is a view.

This method should be called in every public modifying methods before any modifications are performed.

Exceptions
InvalidOperationExceptionif check fails.

Reimplemented from C5.CollectionBase< T >.

virtual bool C5.LinkedList< T >.UpdateOrAdd ( item)
virtual

Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection.

Parameters
itemValue to add or update.
Returns
True if the item was found and updated (hence not added).

Implements C5.ICollection< T >.

virtual bool C5.LinkedList< T >.UpdateOrAdd ( item,
out T  olditem 
)
virtual

Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

virtual IList<T> C5.LinkedList< T >.View ( int  start,
int  count 
)
virtual

Create a list view on this list.

Exceptions
ArgumentOutOfRangeExceptionif the start or count is negative
ArgumentExceptionif the range does not fit within list.
Parameters
startThe index in this list of the start of the view.
countThe size of the view.
Returns
The new list view.

Implements C5.IList< T >.

virtual IList<T> C5.LinkedList< T >.ViewOf ( item)
virtual

Create a list view on this list containing the (first) occurrence of a particular item.

Exceptions
ArgumentExceptionif the item is not in this list.
Parameters
itemThe item to find.
Returns
The new list view.

Implements C5.IList< T >.

Property Documentation

virtual bool C5.LinkedList< T >.AllowsDuplicates
get

True since this collection has bag semantics.

virtual Speed C5.LinkedList< T >.ContainsSpeed
get

The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant).

Speed.Linear

override int C5.LinkedList< T >.Count
get

The number of items in this collection

virtual bool C5.LinkedList< T >.DuplicatesByCounting
get

By convention this is true for any collection with set semantics.

True if only one representative of a group of equal items is kept in the collection together with the total count.

virtual bool C5.LinkedList< T >.FIFO
getset

Since

Add(T item) always add at the end of the list, this describes if list has FIFO or LIFO semantics.

True if the Remove() operation removes from the start of the list, false if it removes from the end. THe default for a new linked list is true.

virtual T C5.LinkedList< T >.First
get

Exceptions
NoSuchItemExceptionif this list is empty.

The first item in this list.

virtual Speed C5.LinkedList< T >.IndexingSpeed
get

virtual bool C5.LinkedList< T >.IsFixedSize
get

virtual bool C5.LinkedList< T >.IsValid
get

virtual T C5.LinkedList< T >.Last
get

Exceptions
NoSuchItemExceptionif this list is empty.

The last item in this list.

override EventTypeEnum C5.LinkedList< T >.ListenableEvents
get

virtual int C5.LinkedList< T >.Offset
get

Offset for this list view or 0 for a underlying list.

virtual T C5.LinkedList< T >.this[int index]
getset

On this list, this indexer is read/write.

Exceptions
IndexOutOfRangeExceptionif i is negative or >= the size of the collection.

The i'th item of this list.

Parameters
indexThe index of the item to fetch or store.
IDirectedCollectionValue<T> C5.LinkedList< T >.this[int start, int count]
get

Exceptions
IndexOutOfRangeException.

The directed collection of items in a specific index interval.

Parameters
startThe low index of the interval (inclusive).
countThe size of the range.
virtual IList<T> C5.LinkedList< T >.Underlying
get

Null if this list is not a view.

Underlying list for view.


The documentation for this class was generated from the following file: