using System; using System.Collections.Generic; namespace MemoryPools.Collections.Linq { public static partial class PoolingEnumerable { /// /// Returns distinct elements from a sequence by using the default equality comparer to compare values. Complexity - O(N) /// public static IPoolingEnumerable Distinct(this IPoolingEnumerable source) => Pool>.Get().Init(source.GetEnumerator(), x => x); /// /// Returns distinct elements from a sequence by using the default equality comparer to compare values and selector to select key to compare by. Complexity - O(N) /// public static IPoolingEnumerable DistinctBy( this IPoolingEnumerable source, Func selector) => Pool>.Get().Init(source.GetEnumerator(), selector); /// /// Returns distinct elements from a sequence by using a specified to compare values. Complexity - O(N) /// public static IPoolingEnumerable Distinct( this IPoolingEnumerable source, IEqualityComparer comparer) => Pool>.Get().Init(source.GetEnumerator(), x => x,comparer); /// /// Returns distinct elements from a sequence by using a specified to compare values and selector to select key to compare by. Complexity - O(N) /// public static IPoolingEnumerable DistinctBy( this IPoolingEnumerable source, Func selector, IEqualityComparer comparer) => Pool>.Get().Init(source.GetEnumerator(), selector, comparer); } }