PowerCollections学习笔记(1):术语解释

public class Bag<T> : CollectionBase<T>, ICloneable
//Bag<T> is a collection that contains items of type T. Unlike a Set, duplicate items (items that compare equal to each other) are allowed in an Bag. 

public class BigList<T> : ListBase<T>, ICloneable
//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. 

public abstract class CollectionBase<T> : ICollection<T>, 
    IEnumerable<T>, ICollection, IEnumerable
//CollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces. 

public class Deque<T> : ListBase<T>, ICloneable
//The Deque class implements a type of list known as a Double Ended Queue. A Deque is quite similar to a List, in that items have indices (starting at 0), and the item at any index can be efficiently retrieved. The difference between a List and a Deque lies in the efficiency of inserting elements at the beginning. In a List, items can be efficiently added to the end, but inserting an item at the beginning of the List is slow, taking time proportional to the size of the List. In a Deque, items can be added to the beginning or end equally efficiently, regardless of the number of items in the Deque. As a trade-off for this increased flexibility, Deque is somewhat slower than List (but still constant time) when being indexed to get or retrieve elements. 

public abstract class DictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, 
    ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, 
    IDictionary, ICollection, IEnumerable
//DictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces. 

public abstract class ListBase<T> : CollectionBase<T>, IList<T>, 
    ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
//ListBase is an abstract class that can be used as a base class for a read-write collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase. 

public class MultiDictionary<TKey, TValue> : MultiDictionaryBase<TKey, TValue>, ICloneable
//The MultiDictionary class that associates values with a key. Unlike an Dictionary, each key can have multiple values associated with it. When indexing an MultiDictionary, instead of a single value associated with a key, you retrieve an enumeration of values.

public abstract class MultiDictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>, IDictionary<TKey, ICollection<TValue>>, 
    ICollection<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, 
    IEnumerable
//MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface. 

public class OrderedBag<T> : CollectionBase<T>, ICloneable
//OrderedBag<T> is a collection that contains items of type T. The item are maintained in a sorted order. Unlike a OrderedSet, duplicate items (items that compare equal to each other) are allows in an OrderedBag. 

public class View : CollectionBase<T>
//The OrderedBag<T>.View class is used to look at a subset of the items inside an ordered bag. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods. 

public class OrderedDictionary<TKey, TValue> : DictionaryBase<TKey, TValue>, ICloneable
//OrderedDictionary<TKey, TValue> is a collection that maps keys of type TKey to values of type TValue. The keys are maintained in a sorted order, and at most one value is permitted for each key. 

public class View : DictionaryBase<TKey, TValue>
//The OrderedDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods. 

public class OrderedMultiDictionary<TKey, TValue> : MultiDictionaryBase<TKey, TValue>, ICloneable
//The OrderedMultiDictionary class that associates values with a key. Unlike an OrderedDictionary, each key can have multiple values associated with it. When indexing an OrderedMultidictionary, instead of a single value associated with a key, you retrieve an enumeration of values.

//All of the key are stored in sorted order. Also, the values associated with a given key are kept in sorted order as well.

//When constructed, you can chose to allow the same value to be associated with a key multiple times, or only one time. 

public class View : MultiDictionaryBase<TKey, TValue>
//The OrderedMultiDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered multi-dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods. 


public class OrderedSet<T> : CollectionBase<T>, ICollection<T>, 
    IEnumerable<T>, IEnumerable, ICloneable
//OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth. 


public class View : CollectionBase<T>, ICollection<T>, 
    IEnumerable<T>, IEnumerable

//The OrderedSet<T>.View class is used to look at a subset of the Items inside an ordered set. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods. 

public struct Pair<TFirst, TSecond> : IComparable, 
    IComparable<Pair<TFirst, TSecond>>
//Stores a pair of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary. 

public abstract class ReadOnlyCollectionBase<T> : ICollection<T>, 
    IEnumerable<T>, ICollection, IEnumerable
//ReadOnlyCollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces for a read-only collection: a collection that does not allow adding or removing elements.

public abstract class ReadOnlyDictionaryBase<TKey, TValue> : ReadOnlyCollectionBase<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, 
    ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, 
    IDictionary, ICollection, IEnumerable
//ReadOnlyDictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces. 


public abstract class ReadOnlyListBase<T> : ReadOnlyCollectionBase<T>, IList<T>, 
    ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
//ReadOnlyListBase is an abstract class that can be used as a base class for a read-only collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the Count property and the get part of the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase. 


public abstract class ReadOnlyMultiDictionaryBase<TKey, TValue> : ReadOnlyCollectionBase<KeyValuePair<TKey, ICollection<TValue>>>, IDictionary<TKey, ICollection<TValue>>, 
    ICollection<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, 
    IEnumerable
//MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface. The resulting collection is read-only -- items cannot be added or removed. 


public class Set<T> : CollectionBase<T>, ICollection<T>, 
    IEnumerable<T>, IEnumerable, ICloneable
//Set<T> is a collection that contains items of type T. The item are maintained in a haphazard, unpredictable order, and duplicate items are not allowed. 


public struct Triple<TFirst, TSecond, TThird> : IComparable, 
    IComparable<Triple<TFirst, TSecond, TThird>>
//Stores a triple of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary. 


public static class Algorithms
{
    public static int BinarySearch<T>(IList<T> list, T item, out int index) where T : IComparable<T>;
    public static int BinarySearch<T>(IList<T> list, T item, Comparison<T> comparison, out int index);
    public static int BinarySearch<T>(IList<T> list, T item, IComparer<T> comparer, out int index);
    public static IEnumerable<Pair<TFirst, TSecond>> CartesianProduct<TFirst, TSecond>(IEnumerable<TFirst> first, IEnumerable<TSecond> second);
    public static IEnumerable<T> Concatenate<T>(params IEnumerable<T>[] collections);
    public static IEnumerable<TDest> Convert<TSource, TDest>(IEnumerable<TSource> sourceCollection, Converter<TSource, TDest> converter);
    public static void Copy<T>(IEnumerable<T> source, IList<T> dest, int destIndex);
    public static void Copy<T>(IEnumerable<T> source, T[] dest, int destIndex);
    public static void Copy<T>(IEnumerable<T> source, IList<T> dest, int destIndex, int count);
    public static void Copy<T>(IEnumerable<T> source, T[] dest, int destIndex, int count);
    public static void Copy<T>(IList<T> source, int sourceIndex, IList<T> dest, int destIndex, int count);
    public static void Copy<T>(IList<T> source, int sourceIndex, T[] dest, int destIndex, int count);
    public static int Count<T>(IEnumerable<T> collection);
    public static int CountEqual<T>(IEnumerable<T> collection, T find);
    public static int CountEqual<T>(IEnumerable<T> collection, T find, IEqualityComparer<T> equalityComparer);
    public static int CountWhere<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static bool DisjointSets<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static bool DisjointSets<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static bool EqualCollections<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static bool EqualCollections<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, BinaryPredicate<T> predicate);
    public static bool EqualCollections<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static bool EqualSets<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static bool EqualSets<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static bool Exists<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static void Fill<T>(IList<T> list, T value);
    public static void Fill<T>(T[] array, T value);
    public static void FillRange<T>(IList<T> list, int start, int count, T value);
    public static void FillRange<T>(T[] array, int start, int count, T value);
    public static int FindFirstIndexWhere<T>(IList<T> list, Predicate<T> predicate);
    public static T FindFirstWhere<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static IEnumerable<int> FindIndicesWhere<T>(IList<T> list, Predicate<T> predicate);
    public static int FindLastIndexWhere<T>(IList<T> list, Predicate<T> predicate);
    public static T FindLastWhere<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static IEnumerable<T> FindWhere<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static int FirstConsecutiveEqual<T>(IList<T> list, int count);
    public static int FirstConsecutiveEqual<T>(IList<T> list, int count, BinaryPredicate<T> predicate);
    public static int FirstConsecutiveEqual<T>(IList<T> list, int count, IEqualityComparer<T> equalityComparer);
    public static int FirstConsecutiveWhere<T>(IList<T> list, int count, Predicate<T> predicate);
    public static int FirstIndexOf<T>(IList<T> list, T item);
    public static int FirstIndexOf<T>(IList<T> list, T item, IEqualityComparer<T> equalityComparer);
    public static int FirstIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor);
    public static int FirstIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, BinaryPredicate<T> predicate);
    public static int FirstIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, IEqualityComparer<T> equalityComparer);
    public static void ForEach<T>(IEnumerable<T> collection, Action<T> action);
    public static IEnumerable<T[]> GeneratePermutations<T>(IEnumerable<T> collection);
    public static IEnumerable<T[]> GenerateSortedPermutations<T>(IEnumerable<T> collection) where T : IComparable<T>;
    public static IEnumerable<T[]> GenerateSortedPermutations<T>(IEnumerable<T> collection, Comparison<T> comparison);
    public static IEnumerable<T[]> GenerateSortedPermutations<T>(IEnumerable<T> collection, IComparer<T> comparer);
    public static IEqualityComparer<IEnumerable<T>> GetCollectionEqualityComparer<T>();
    public static IEqualityComparer<IEnumerable<T>> GetCollectionEqualityComparer<T>(IEqualityComparer<T> equalityComparer);
    public static IComparer<T> GetComparerFromComparison<T>(Comparison<T> comparison);
    public static Comparison<T> GetComparisonFromComparer<T>(IComparer<T> comparer);
    public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
    public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TValue defaultValue);
    public static IEqualityComparer<T> GetIdentityComparer<T>() where T : class;
    public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>() where T : IComparable<T>;
    public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>(Comparison<T> comparison);
    public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>(IComparer<T> comparer);
    public static IComparer<T> GetReverseComparer<T>(IComparer<T> comparer);
    public static Comparison<T> GetReverseComparison<T>(Comparison<T> comparison);
    public static IEqualityComparer<IEnumerable<T>> GetSetEqualityComparer<T>();
    public static IEqualityComparer<IEnumerable<T>> GetSetEqualityComparer<T>(IEqualityComparer<T> equalityComparer);
    public static int IndexOfMaximum<T>(IList<T> list) where T : IComparable<T>;
    public static int IndexOfMaximum<T>(IList<T> list, Comparison<T> comparison);
    public static int IndexOfMaximum<T>(IList<T> list, IComparer<T> comparer);
    public static int IndexOfMinimum<T>(IList<T> list) where T : IComparable<T>;
    public static int IndexOfMinimum<T>(IList<T> list, Comparison<T> comparison);
    public static int IndexOfMinimum<T>(IList<T> list, IComparer<T> comparer);
    public static IEnumerable<int> IndicesOf<T>(IList<T> list, T item);
    public static IEnumerable<int> IndicesOf<T>(IList<T> list, T item, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<int> IndicesOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor);
    public static IEnumerable<int> IndicesOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, BinaryPredicate<T> predicate);
    public static IEnumerable<int> IndicesOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, IEqualityComparer<T> equalityComparer);
    public static bool IsProperSubsetOf<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static bool IsProperSubsetOf<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static bool IsSubsetOf<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static bool IsSubsetOf<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static int LastIndexOf<T>(IList<T> list, T item);
    public static int LastIndexOf<T>(IList<T> list, T item, IEqualityComparer<T> equalityComparer);
    public static int LastIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor);
    public static int LastIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, BinaryPredicate<T> predicate);
    public static int LastIndexOfMany<T>(IList<T> list, IEnumerable<T> itemsToLookFor, IEqualityComparer<T> equalityComparer);
    public static int LexicographicalCompare<T>(IEnumerable<T> sequence1, IEnumerable<T> sequence2) where T : IComparable<T>;
    public static int LexicographicalCompare<T>(IEnumerable<T> sequence1, IEnumerable<T> sequence2, Comparison<T> comparison);
    public static int LexicographicalCompare<T>(IEnumerable<T> sequence1, IEnumerable<T> sequence2, IComparer<T> comparer);
    public static T Maximum<T>(IEnumerable<T> collection) where T : IComparable<T>;
    public static T Maximum<T>(IEnumerable<T> collection, Comparison<T> comparison);
    public static T Maximum<T>(IEnumerable<T> collection, IComparer<T> comparer);
    public static IEnumerable<T> MergeSorted<T>(params IEnumerable<T>[] collections) where T : IComparable<T>;
    public static IEnumerable<T> MergeSorted<T>(Comparison<T> comparison, params IEnumerable<T>[] collections);
    public static IEnumerable<T> MergeSorted<T>(IComparer<T> comparer, params IEnumerable<T>[] collections);
    public static T Minimum<T>(IEnumerable<T> collection) where T : IComparable<T>;
    public static T Minimum<T>(IEnumerable<T> collection, Comparison<T> comparison);
    public static T Minimum<T>(IEnumerable<T> collection, IComparer<T> comparer);
    public static IEnumerable<T> NCopiesOf<T>(int n, T item);
    public static int Partition<T>(IList<T> list, Predicate<T> predicate);
    public static T[] RandomShuffle<T>(IEnumerable<T> collection);
    public static T[] RandomShuffle<T>(IEnumerable<T> collection, Random randomGenerator);
    public static void RandomShuffleInPlace<T>(IList<T> list);
    public static void RandomShuffleInPlace<T>(IList<T> list, Random randomGenerator);
    public static T[] RandomSubset<T>(IEnumerable<T> collection, int count);
    public static T[] RandomSubset<T>(IEnumerable<T> collection, int count, Random randomGenerator);
    public static IList<T> Range<T>(IList<T> list, int start, int count);
    public static IList<T> Range<T>(T[] array, int start, int count);
    public static ICollection<T> ReadOnly<T>(ICollection<T> collection);
    public static IDictionary<TKey, TValue> ReadOnly<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
    public static IList<T> ReadOnly<T>(IList<T> list);
    public static IList<T> ReadWriteList<T>(T[] array);
    public static IEnumerable<T> RemoveDuplicates<T>(IEnumerable<T> collection);
    public static IEnumerable<T> RemoveDuplicates<T>(IEnumerable<T> collection, BinaryPredicate<T> predicate);
    public static IEnumerable<T> RemoveDuplicates<T>(IEnumerable<T> collection, IEqualityComparer<T> equalityComparer);
    public static void RemoveDuplicatesInPlace<T>(IList<T> list);
    public static void RemoveDuplicatesInPlace<T>(IList<T> list, BinaryPredicate<T> predicate);
    public static void RemoveDuplicatesInPlace<T>(IList<T> list, IEqualityComparer<T> equalityComparer);
    public static ICollection<T> RemoveWhere<T>(ICollection<T> collection, Predicate<T> predicate);
    public static IEnumerable<T> Replace<T>(IEnumerable<T> collection, Predicate<T> predicate, T replaceWith);
    public static IEnumerable<T> Replace<T>(IEnumerable<T> collection, T itemFind, T replaceWith);
    public static IEnumerable<T> Replace<T>(IEnumerable<T> collection, T itemFind, T replaceWith, IEqualityComparer<T> equalityComparer);
    public static void ReplaceInPlace<T>(IList<T> list, Predicate<T> predicate, T replaceWith);
    public static void ReplaceInPlace<T>(IList<T> list, T itemFind, T replaceWith);
    public static void ReplaceInPlace<T>(IList<T> list, T itemFind, T replaceWith, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<T> Reverse<T>(IList<T> source);
    public static void ReverseInPlace<T>(IList<T> list);
    public static IEnumerable<T> Rotate<T>(IList<T> source, int amountToRotate);
    public static void RotateInPlace<T>(IList<T> list, int amountToRotate);
    public static int SearchForSubsequence<T>(IList<T> list, IEnumerable<T> pattern);
    public static int SearchForSubsequence<T>(IList<T> list, IEnumerable<T> pattern, BinaryPredicate<T> predicate);
    public static int SearchForSubsequence<T>(IList<T> list, IEnumerable<T> pattern, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<T> SetDifference<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static IEnumerable<T> SetDifference<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<T> SetIntersection<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static IEnumerable<T> SetIntersection<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<T> SetSymmetricDifference<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static IEnumerable<T> SetSymmetricDifference<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static IEnumerable<T> SetUnion<T>(IEnumerable<T> collection1, IEnumerable<T> collection2);
    public static IEnumerable<T> SetUnion<T>(IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer);
    public static T[] Sort<T>(IEnumerable<T> collection) where T : IComparable<T>;
    public static T[] Sort<T>(IEnumerable<T> collection, Comparison<T> comparison);
    public static T[] Sort<T>(IEnumerable<T> collection, IComparer<T> comparer);
    public static void SortInPlace<T>(IList<T> list) where T : IComparable<T>;
    public static void SortInPlace<T>(IList<T> list, Comparison<T> comparison);
    public static void SortInPlace<T>(IList<T> list, IComparer<T> comparer);
    public static int StablePartition<T>(IList<T> list, Predicate<T> predicate);
    public static T[] StableSort<T>(IEnumerable<T> collection) where T : IComparable<T>;
    public static T[] StableSort<T>(IEnumerable<T> collection, Comparison<T> comparison);
    public static T[] StableSort<T>(IEnumerable<T> collection, IComparer<T> comparer);
    public static void StableSortInPlace<T>(IList<T> list) where T : IComparable<T>;
    public static void StableSortInPlace<T>(IList<T> list, Comparison<T> comparison);
    public static void StableSortInPlace<T>(IList<T> list, IComparer<T> comparer);
    public static T[] ToArray<T>(IEnumerable<T> collection);
    public static string ToString<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
    public static string ToString<T>(IEnumerable<T> collection);
    public static string ToString<T>(IEnumerable<T> collection, bool recursive, string start, string separator, string end);
    public static bool TrueForAll<T>(IEnumerable<T> collection, Predicate<T> predicate);
    public static bool TryFindFirstWhere<T>(IEnumerable<T> collection, Predicate<T> predicate, out T foundItem);
    public static bool TryFindLastWhere<T>(IEnumerable<T> collection, Predicate<T> predicate, out T foundItem);
    public static ICollection<T> TypedAs<T>(ICollection untypedCollection);
    public static IEnumerable<T> TypedAs<T>(IEnumerable untypedCollection);
    public static IList<T> TypedAs<T>(IList untypedList);
    public static ICollection Untyped<T>(ICollection<T> typedCollection);
    public static IList Untyped<T>(IList<T> typedList);
}
posted @ 2011-10-20 10:38 华志昊 阅读(23) 评论(0) 编辑 收藏