Click or drag to resize

LinkedBucketListT Class

Simple doubly linked list which doesn't suffer from the problem that one can't concat two linked lists in O(1). The .NET LinkedList class can't be used to fast connect two LinkedLists together without traversing all nodes of one of them (as each node has a reference to its containing list)
Inheritance Hierarchy
SystemObject
  SD.Tools.Algorithmia.GeneralDataStructuresLinkedBucketListT

Namespace:  SD.Tools.Algorithmia.GeneralDataStructures
Assembly:  SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.3.3.0 (1.3.18.0209)
Syntax
public class LinkedBucketList<T> : IEnumerable<T>, 
	IEnumerable

Type Parameters

T
Type of contents in the buckets in this list

The LinkedBucketListT type exposes the following members.

Constructors
  NameDescription
Public methodLinkedBucketListT
Initializes a new instance of the LinkedBucketListT class
Top
Properties
  NameDescription
Public propertyCount
Gets the number of elements in this list.
Public propertyHead
Gets the head of the list
Public propertyTail
Gets the tail of the list.
Top
Methods
  NameDescription
Public methodAppendTail(T)
Appends the specified contents in a new bucket after the last element in the list as a new tail.
Public methodAppendTail(ListBucketT)
Appends the specified bucket to the list, after the last element as a new tail.
Public methodClear
Clears this instance. It doesn't reset the individual nodes, it just cuts off references to head and tail so the list contents goes out of scope.
Public methodConcat
Concats the specified list after this list in an O(1) operation.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind(T)
Finds the bucket with the specified contents.
Public methodFind(T, FuncT, T, Boolean)
Finds the bucket with the specified contents using the comparer func specified.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInsertAfter
Inserts the specified node toInsert after the node toInsertAfter.
Public methodInsertBefore
Inserts the specified node toInsert before the node toInsertBefore.
Public methodInsertHead(T)
Inserts the specified contents in a new bucket as the new head in the list.
Public methodInsertHead(ListBucketT)
Inserts the specified bucket as the new head in the list.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove(T)
Removes the bucket with the specified contents from the list
Public methodRemove(ListBucketT)
Removes the specified bucket from the list.
Public methodRemove(T, FuncT, T, Boolean)
Removes the bucket with the specified contents from the list
Public methodRemoveAfter
Removes all buckets after the node specified. It assumes the specified node is in the ListBucketList. If it's not, all nodes in this list will be removed and the list will be empty.
Public methodRemoveBefore
Removes all buckets before the node specified. It assumes the specified node is in the ListBucketList. If it's not, all nodes in this list will be removed and the list will be empty.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodSetEqualT(IEnumerableT)Overloaded.
Checks whether the enumerable to compare with is equal to the source enumerable, element wise. If elements are in a different order, the method will still return true. This is different from SequenceEqual which does take order into account
(Defined by IEnumerableExtensionMethods.)
Public Extension MethodSetEqualT(IEnumerableT, IEqualityComparerT)Overloaded.
Checks whether the enumerable to compare with is equal to the source enumerable, element wise. If elements are in a different order, the method will still return true. This is different from SequenceEqual which does take order into account
(Defined by IEnumerableExtensionMethods.)
Public Extension MethodToFilteringBindingListT
Converts the passed in enumerable to a FilteringBindingList
(Defined by ExtensionMethods.)
Public Extension MethodToHashSetT
Creates a new hashset and adds the source to it.
(Defined by IEnumerableExtensionMethods.)
Public Extension MethodToListSafeT
Converts the passed in enumerable to a List(Of T). If toEnumerate is a CommandifiedList(Of T) it will lock on its SyncRoot if it's a synchronized CommandifiedList. if it's not a commandified list, it will simply call ToList() on the enumerable. If toEnumerate is null, null is returned.
(Defined by ExtensionMethods.)
Public Extension MethodToReadOnlyCollectionTDestination
Converts the enumerable to a ReadOnlyCollection.
(Defined by IEnumerableExtensionMethods.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through a collection.
Top
Remarks
One could use the ListBucket class on its own as a raw linked list, however this class provides more utility code one will need anyway to use ListBucket instances in practise. If nodes are added to the linked list of buckets by using the ListBucket nodes themselves the count doesn't match, however doing so will also mess up the head/tail housekeeping references. So either use solely the buckets as a linked list, or use this instance to manage the linked list of buckets
See Also