Click or drag to resize
BigListT Class
BigList<T> provides a list of items, in order, with indices of the items ranging from 0 to one less than the count of items in the collection. BigList<T> is optimized for efficient operations on large (>100 items) lists, especially for insertions, deletions, copies, and concatinations.
Inheritance Hierarchy
SystemObject
  X3Platform.CollectionsCollectionBaseT
    X3Platform.CollectionsListBaseT
      X3Platform.CollectionsBigListT

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
[SerializableAttribute]
public class BigList<T> : ListBase<T>, ICloneable

Type Parameters

T
The type of items to store in the BigList.

The BigListT type exposes the following members.

Constructors
  NameDescription
Public methodBigListT
Creates a new BigList. The BigList is initially empty.
Public methodBigListT(IEnumerableT)
Creates a new BigList initialized with the items from collection, in order.
Public methodBigListT(BigListT)
Creates a new BigList that is a copy of list.
Public methodBigListT(IEnumerableT, Int32)
Creates a new BigList initialized with a given number of copies of the items from collection, in order.
Public methodBigListT(BigListT, Int32)
Creates a new BigList that is several copies of list.
Top
Methods
  NameDescription
Public methodAdd
Adds an item to the end of the BigList. The indices of all existing items in the Deque are unchanged.
(Overrides ListBaseTAdd(T).)
Public methodAddRange(IEnumerableT)
Adds a collection of items to the end of BigList. The indices of all existing items are unchanged. The last item in the added collection becomes the last item in the BigList.
Public methodAddRange(BigListT)
Adds a BigList of items to the end of BigList. The indices of all existing items are unchanged. The last item in list becomes the last item in this list. The added list list is unchanged.
Public methodAddRangeToFront(IEnumerableT)
Adds a collection of items to the front of BigList. The indices of all existing items in the are increased by the number of items in collection. The first item in the added collection becomes the first item in the BigList.
Public methodAddRangeToFront(BigListT)
Adds a BigList of items to the front of BigList. The indices of all existing items are increased by the number of items in list. The first item in list becomes the first item in this list. The added list list is unchanged.
Public methodAddToFront
Adds an item to the beginning of the BigList. The indices of all existing items in the Deque are increased by one, and the new item has index zero.
Public methodAsReadOnly
Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view.
(Inherited from ListBaseT.)
Public methodBinarySearch(T)
Searches a sorted list for an item via binary search. The list must be sorted in the order defined by the default ordering of the item type; otherwise, incorrect results will be returned.
Public methodBinarySearch(T, IComparerT)
Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed IComparer<T> interface; otherwise, incorrect results will be returned.
Public methodBinarySearch(T, ComparisonT)
Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed Comparison<T> delegate; otherwise, incorrect results will be returned.
Public methodClear
Removes all of the items from the BigList.
(Overrides ListBaseTClear.)
Public methodClone
Creates a new BigList that is a copy of this list.
Public methodCloneContents
Makes a deep clone of this BigList. A new BigList is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then this method is the same as Clone.
Public methodContains
Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.
(Inherited from ListBaseT.)
Public methodConvertAllTDest(ConverterT, TDest)
Convert the list to a new list by applying a delegate to each item in the collection. The resulting list contains the result of applying converter to each item in the list, in order. The current list is unchanged.
Public methodConvertAllTOutput(ConverterT, TOutput)
Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
(Inherited from CollectionBaseT.)
Public methodCopyTo(T)
Copies all the items in the list, in order, to array, starting at index 0.
(Inherited from ListBaseT.)
Public methodCopyTo(T, Int32)
Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
(Inherited from CollectionBaseT.)
Public methodCopyTo(Int32, T, Int32, Int32)
Copies a range of elements from the list to array, starting at arrayIndex.
(Inherited from ListBaseT.)
Public methodCountWhere
Counts the number of items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodEquals (Inherited from Object.)
Public methodExists
Determines if the collection contains any item that satisfies the condition defined by predicate.
(Inherited from CollectionBaseT.)
Protected methodFinalize (Inherited from Object.)
Public methodFind
Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
(Inherited from ListBaseT.)
Public methodFindAll
Enumerates the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodFindIndex(PredicateT)
Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodFindIndex(Int32, PredicateT)
Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodFindIndex(Int32, Int32, PredicateT)
Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodFindLast
Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
(Inherited from ListBaseT.)
Public methodFindLastIndex(PredicateT)
Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodFindLastIndex(Int32, PredicateT)
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodFindLastIndex(Int32, Int32, PredicateT)
Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
(Inherited from ListBaseT.)
Public methodForEach
Performs the specified action on each item in this collection.
(Inherited from CollectionBaseT.)
Public methodGetEnumerator
Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. Usually, the foreach statement is used to call this method implicitly.
(Overrides ListBaseTGetEnumerator.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetRange
Creates a new list that contains a subrange of elements from this list. The current list is unchanged.
Public methodGetType (Inherited from Object.)
Public methodIndexOf(T)
Finds the index of the first item in the list that is equal to item.
(Inherited from ListBaseT.)
Public methodIndexOf(T, Int32)
Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
(Inherited from ListBaseT.)
Public methodIndexOf(T, Int32, Int32)
Finds the index of the first item, in the range of count items starting from index, that is equal to item.
(Inherited from ListBaseT.)
Public methodInsert
Inserts a new item at the given index in the BigList. All items at indexes equal to or greater than index move up one index.
(Overrides ListBaseTInsert(Int32, T).)
Public methodInsertRange(Int32, IEnumerableT)
Inserts a collection of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public methodInsertRange(Int32, BigListT)
Inserts a BigList of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public methodLastIndexOf(T)
Finds the index of the last item in the list that is equal to item.
(Inherited from ListBaseT.)
Public methodLastIndexOf(T, Int32)
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
(Inherited from ListBaseT.)
Public methodLastIndexOf(T, Int32, Int32)
Finds the index of the last item, in the range of count items ending at index, that is equal to item.
(Inherited from ListBaseT.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRange
Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
(Overrides ListBaseTRange(Int32, Int32).)
Public methodRemove
Searches the list for the first item that compares equal to item. If one is found, it is removed. Otherwise, the list is unchanged.
(Inherited from ListBaseT.)
Public methodRemoveAll
Removes all the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodRemoveAt
Removes the item at the given index in the BigList. All items at indexes greater than index move down one index.
(Overrides ListBaseTRemoveAt(Int32).)
Public methodRemoveRange
Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.
Public methodReverse
Reverses the current list in place.
Public methodReverse(Int32, Int32)
Reverses the items in the range of count items starting from start, in place.
Public methodSort
Sorts the list in place.
Public methodSort(IComparerT)
Sorts the list in place. A supplied IComparer<T> is used to compare the items in the list.
Public methodSort(ComparisonT)
Sorts the list in place. A supplied Comparison<T> delegate is used to compare the items in the list.
Public methodToArray
Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
(Inherited from CollectionBaseT.)
Public methodToString
Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.
(Inherited from CollectionBaseT.)
Public methodTrueForAll
Determines if all of the items in the collection satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodTryFind
Finds the first item in the list that satisfies the condition defined by predicate.
(Inherited from ListBaseT.)
Public methodTryFindLast
Finds the last item in the list that satisfies the condition defined by predicate.
(Inherited from ListBaseT.)
Top
Operators
  NameDescription
Public operatorStatic memberAddition
Concatenates two lists together to create a new list. Both lists being concatenated are unchanged. The resulting list contains all the items in first, followed by all the items in second.
Top
Properties
Remarks

BigList<T> class is similar in functionality to the standard List<T> class. Both classes provide a collection that stores an set of items in order, with indices of the items ranging from 0 to one less than the count of items in the collection. Both classes provide the ability to add and remove items from any index, and the get or set the item at any index.

BigList<T> differs significantly from List<T> in the performance of various operations, especially when the lists become large (several hundred items or more). With List<T>, inserting or removing elements from anywhere in a large list except the end is very inefficient -- every item after the point of inserting or deletion has to be moved in the list. The BigList<T> class, however, allows for fast insertions and deletions anywhere in the list. Furthermore, BigList<T> allows copies of a list, sub-parts of a list, and concatinations of two lists to be very fast. When a copy is made of part or all of a BigList, two lists shared storage for the parts of the lists that are the same. Only when one of the lists is changed is additional memory allocated to store the distinct parts of the lists.

Of course, there is a small price to pay for this extra flexibility. Although still quite efficient, using an index to get or change one element of a BigList, while still reasonably efficient, is significantly slower than using a plain List. Because of this, if you want to process every element of a BigList, using a foreach loop is a lot more efficient than using a for loop and indexing the list.

In general, use a List when the only operations you are using are Add (to the end), foreach, or indexing, or you are very sure the list will always remain small (less than 100 items). For large (>100 items) lists that do insertions, removals, copies, concatinations, or sub-ranges, BigList will be more efficient than List. In almost all cases, BigList is more efficient and easier to use than LinkedList.

See Also