Class EnumerableDefaults
- java.lang.Object
-
- org.apache.calcite.linq4j.EnumerableDefaults
-
public abstract class EnumerableDefaults extends Object
Default implementations of methods in theEnumerableinterface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classEnumerableDefaults.CastingEnumerator<T>Enumerator that casts each value.private static classEnumerableDefaults.LookupResultEnumerable<TResult,TKey,TAccumulate>Reads a populated map, applying a selector function.private static classEnumerableDefaults.MergeJoinEnumerator<TResult,TSource,TInner,TKey extends Comparable<TKey>>Enumerator that performs a merge join on its sorted inputs.(package private) static classEnumerableDefaults.SkipWhileEnumerator<TSource>Enumerator that implements skip-while.(package private) static classEnumerableDefaults.TakeWhileEnumerator<TSource>Enumerable that implements take-while.(package private) static classEnumerableDefaults.TakeWhileLongEnumerator<TSource>Enumerable that implements take-while.private static classEnumerableDefaults.WrapMap<K,V>Map that wraps each value.private static classEnumerableDefaults.Wrapped<T>Value wrapped with a comparer.
-
Constructor Summary
Constructors Constructor Description EnumerableDefaults()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <TSource> TSourceaggregate(Enumerable<TSource> source, Function2<TSource,TSource,TSource> func)Applies an accumulator function over a sequence.static <TSource,TAccumulate>
TAccumulateaggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func)Applies an accumulator function over a sequence.static <TSource,TAccumulate,TResult>
TResultaggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func, Function1<TAccumulate,TResult> selector)Applies an accumulator function over a sequence.static <TSource> booleanall(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Determines whether all elements of a sequence satisfy a condition.static booleanany(Enumerable enumerable)Determines whether a sequence contains any elements.static <TSource> booleanany(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Determines whether any element of a sequence satisfies a condition.static <TSource> Enumerable<TSource>asEnumerable(Enumerable<TSource> enumerable)Returns the input typed asEnumerable<TSource>.static <T> OrderedQueryable<T>asOrderedQueryable(Enumerable<T> source)static <TSource> Queryable<TSource>asQueryable(Enumerable<TSource> enumerable)Converts an Enumerable to an IQueryable.static <TSource> BigDecimalaverage(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> doubleaverage(Enumerable<TSource> source, DoubleFunction1<TSource> selector)Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> floataverage(Enumerable<TSource> source, FloatFunction1<TSource> selector)Computes the average of a sequence of Float values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> intaverage(Enumerable<TSource> source, IntegerFunction1<TSource> selector)Computes the average of a sequence of int values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> longaverage(Enumerable<TSource> source, LongFunction1<TSource> selector)Computes the average of a sequence of long values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> BigDecimalaverage(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Doubleaverage(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Floataverage(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)Computes the average of a sequence of nullable Float values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Integeraverage(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)Computes the average of a sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Longaverage(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)Computes the average of a sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence.static <TSource,T2>
Enumerable<T2>cast(Enumerable<TSource> source, Class<T2> clazz)Analogous to LINQ's Enumerable.Cast extension method.static <TSource> Enumerable<TSource>concat(Enumerable<TSource> enumerable0, Enumerable<TSource> enumerable1)Concatenates two sequences.static <TSource> booleancontains(Enumerable<TSource> enumerable, TSource element)Determines whether a sequence contains a specified element by using the default equality comparer.static <TSource> booleancontains(Enumerable<TSource> enumerable, TSource element, EqualityComparer<TSource> comparer)Determines whether a sequence contains a specified element by using a specifiedEqualityComparer<TSource>.static <TSource,TInner,TResult>
Enumerable<TResult>correlateJoin(CorrelateJoinType joinType, Enumerable<TSource> outer, Function1<TSource,Enumerable<TInner>> inner, Function2<TSource,TInner,TResult> resultSelector)Returns elements ofouterfor which there is a member ofinnerwith a matching key.static <TSource> intcount(Enumerable<TSource> enumerable)Returns the number of elements in a sequence.static <TSource> intcount(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns a number that represents how many elements in the specified sequence satisfy a condition.static <TSource,TKey>
OrderedEnumerable<TSource>createOrderedEnumerable(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator, boolean descending)Performs a subsequent ordering of the elements in a sequence according to a key.static <TSource> Enumerable<TSource>defaultIfEmpty(Enumerable<TSource> enumerable)Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.static <TSource> Enumerable<TSource>defaultIfEmpty(Enumerable<TSource> enumerable, TSource value)Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.static <TSource> Enumerable<TSource>distinct(Enumerable<TSource> enumerable)Returns distinct elements from a sequence by using the defaultEqualityComparerto compare values.static <TSource> Enumerable<TSource>distinct(Enumerable<TSource> enumerable, EqualityComparer<TSource> comparer)Returns distinct elements from a sequence by using a specifiedEqualityComparerto compare values.static <TSource> TSourceelementAt(Enumerable<TSource> enumerable, int index)Returns the element at a specified index in a sequence.static <TSource> TSourceelementAtOrDefault(Enumerable<TSource> enumerable, int index)Returns the element at a specified index in a sequence or a default value if the index is out of range.static <TSource> Enumerable<TSource>except(Enumerable<TSource> source0, Enumerable<TSource> source1)Produces the set difference of two sequences by using the default equality comparer to compare values.static <TSource> Enumerable<TSource>except(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)Produces the set difference of two sequences by using the specifiedEqualityComparer<TSource>to compare values.static <TSource> TSourcefirst(Enumerable<TSource> enumerable)Returns the first element of a sequence.static <TSource> TSourcefirst(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns the first element in a sequence that satisfies a specified condition.static <TSource> TSourcefirstOrDefault(Enumerable<TSource> enumerable)Returns the first element of a sequence, or a default value if the sequence contains no elements.static <TSource> TSourcefirstOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.static <TSource,TKey>
Enumerable<Grouping<TKey,TSource>>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector)Groups the elements of a sequence according to a specified key selector function.static <TSource,TKey>
Enumerable<Grouping<TKey,TSource>>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.static <TSource,TKey,TAccumulate,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)Groups the elements of a sequence according to a specified key selector function, initializing an accumulator for each group and adding to it each time an element with the same key is seen.static <TSource,TKey,TAccumulate,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector, EqualityComparer<TKey> comparer)Groups the elements of a sequence according to a specified key selector function, initializing an accumulator for each group and adding to it each time an element with the same key is seen.static <TSource,TKey,TElement>
Enumerable<Grouping<TKey,TElement>>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.static <TSource,TKey,TElement>
Enumerable<Grouping<TKey,TElement>>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)Groups the elements of a sequence according to a key selector function.static <TSource,TKey,TElement,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, Function2<TKey,Enumerable<TElement>,TResult> resultSelector)Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.static <TSource,TKey,TElement,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, Function2<TKey,Enumerable<TElement>,TResult> resultSelector, EqualityComparer<TKey> comparer)Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.static <TSource,TKey,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector)Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.static <TSource,TKey,TResult>
Enumerable<TResult>groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector, EqualityComparer<TKey> comparer)Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.private static <TSource,TKey,TAccumulate,TResult>
Enumerable<TResult>groupBy_(Map<TKey,TAccumulate> map, Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)private static <TSource,TKey,TResult>
Enumerable<TResult>groupBy_(Set<TKey> map, Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TKey,TResult> resultSelector)static <TSource,TKey,TAccumulate,TResult>
Enumerable<TResult>groupByMultiple(Enumerable<TSource> enumerable, List<Function1<TSource,TKey>> keySelectors, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)Groups the elements of a sequence according to a list of specified key selector functions, initializing an accumulator for each group and adding to it each time an element with the same key is seen.private static <TSource,TKey,TAccumulate,TResult>
Enumerable<TResult>groupByMultiple_(Map<TKey,TAccumulate> map, Enumerable<TSource> enumerable, List<Function1<TSource,TKey>> keySelectors, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)static <TSource,TInner,TKey,TResult>
Enumerable<TResult>groupJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,Enumerable<TInner>,TResult> resultSelector)Correlates the elements of two sequences based on equality of keys and groups the results.static <TSource,TInner,TKey,TResult>
Enumerable<TResult>groupJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,Enumerable<TInner>,TResult> resultSelector, EqualityComparer<TKey> comparer)Correlates the elements of two sequences based on key equality and groups the results.static <TSource> Enumerable<TSource>intersect(Enumerable<TSource> source0, Enumerable<TSource> source1)Produces the set intersection of two sequences by using the default equality comparer to compare values.static <TSource> Enumerable<TSource>intersect(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)Produces the set intersection of two sequences by using the specifiedEqualityComparer<TSource>to compare values.static <T,C extends Collection<? super T>>
Cinto(Enumerable<T> source, C sink)Default implementation ofExtendedEnumerable.into(Collection).static <TSource,TInner,TKey,TResult>
Enumerable<TResult>join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector)Correlates the elements of two sequences based on matching keys.static <TSource,TInner,TKey,TResult>
Enumerable<TResult>join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer)Correlates the elements of two sequences based on matching keys.static <TSource,TInner,TKey,TResult>
Enumerable<TResult>join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)Correlates the elements of two sequences based on matching keys.private static <TSource,TInner,TKey,TResult>
Enumerable<TResult>join_(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)Implementation of join that builds the right input and probes with the left.static <TSource> TSourcelast(Enumerable<TSource> enumerable)Returns the last element of a sequence.static <TSource> TSourcelast(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns the last element of a sequence that satisfies a specified condition.static <TSource> TSourcelastOrDefault(Enumerable<TSource> enumerable)Returns the last element of a sequence, or a default value if the sequence contains no elements.static <TSource> TSourcelastOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.static <TSource> longlongCount(Enumerable<TSource> source)Returns an long that represents the total number of elements in a sequence.static <TSource> longlongCount(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)Returns an long that represents how many elements in a sequence satisfy a condition.static <TSource extends Comparable<TSource>>
TSourcemax(Enumerable<TSource> source)Returns the maximum value in a generic sequence.static <TSource> BigDecimalmax(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum Decimal value.static <TSource> doublemax(Enumerable<TSource> source, DoubleFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum Double value.static <TSource> floatmax(Enumerable<TSource> source, FloatFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum Float value.static <TSource,TResult extends Comparable<TResult>>
TResultmax(Enumerable<TSource> source, Function1<TSource,TResult> selector)Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.static <TSource> intmax(Enumerable<TSource> source, IntegerFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum int value.static <TSource> longmax(Enumerable<TSource> source, LongFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum long value.static <TSource> BigDecimalmax(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.static <TSource> Doublemax(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.static <TSource> Floatmax(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum nullable Float value.static <TSource> Integermax(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum nullable int value.static <TSource> Longmax(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the maximum nullable long value.private static <TSource extends Comparable<TSource>>
Function2<TSource,TSource,TSource>maxFunction()static <TSource,TInner,TKey extends Comparable<TKey>,TResult>
Enumerable<TResult>mergeJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight)Joins two inputs that are sorted on the key.static <TSource extends Comparable<TSource>>
TSourcemin(Enumerable<TSource> source)Returns the minimum value in a generic sequence.static <TSource> BigDecimalmin(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum Decimal value.static <TSource> doublemin(Enumerable<TSource> source, DoubleFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum Double value.static <TSource> floatmin(Enumerable<TSource> source, FloatFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum Float value.static <TSource,TResult extends Comparable<TResult>>
TResultmin(Enumerable<TSource> source, Function1<TSource,TResult> selector)Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.static <TSource> intmin(Enumerable<TSource> source, IntegerFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum int value.static <TSource> longmin(Enumerable<TSource> source, LongFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum long value.static <TSource> BigDecimalmin(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.static <TSource> Doublemin(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.static <TSource> Floatmin(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum nullable Float value.static <TSource> Integermin(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum nullable int value.static <TSource> Longmin(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)Invokes a transform function on each element of a sequence and returns the minimum nullable long value.private static <TSource extends Comparable<TSource>>
Function2<TSource,TSource,TSource>minFunction()static <TSource,TResult>
Enumerable<TResult>ofType(Enumerable<TSource> enumerable, Class<TResult> clazz)Filters the elements of an Enumerable based on a specified type.static <TSource,TKey extends Comparable>
Enumerable<TSource>orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)Sorts the elements of a sequence in ascending order according to a key.static <TSource,TKey>
Enumerable<TSource>orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)Sorts the elements of a sequence in ascending order by using a specified comparer.static <TSource,TKey extends Comparable>
Enumerable<TSource>orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)Sorts the elements of a sequence in descending order according to a key.static <TSource,TKey>
Enumerable<TSource>orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)Sorts the elements of a sequence in descending order by using a specified comparer.static <T,C extends Collection<? super T>>
Cremove(Enumerable<T> source, C sink)Default implementation ofExtendedEnumerable.removeAll(Collection).static <TSource> Enumerable<TSource>reverse(Enumerable<TSource> source)Inverts the order of the elements in a sequence.static <TSource,TResult>
Enumerable<TResult>select(Enumerable<TSource> source, Function1<TSource,TResult> selector)Projects each element of a sequence into a new form.static <TSource,TResult>
Enumerable<TResult>select(Enumerable<TSource> source, Function2<TSource,Integer,TResult> selector)Projects each element of a sequence into a new form by incorporating the element's index.static <TSource,TCollection,TResult>
Enumerable<TResult>selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)Projects each element of a sequence to anEnumerable<TSource>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.static <TSource,TResult>
Enumerable<TResult>selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TResult>> selector)Projects each element of a sequence to anEnumerable<TSource>and flattens the resulting sequences into one sequence.static <TSource,TCollection,TResult>
Enumerable<TResult>selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)Projects each element of a sequence to anEnumerable<TSource>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.static <TSource,TResult>
Enumerable<TResult>selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TResult>> selector)Projects each element of a sequence to anEnumerable<TSource>, and flattens the resulting sequences into one sequence.static <TSource,TInner,TKey>
Enumerable<TSource>semiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector)Returns elements ofouterfor which there is a member ofinnerwith a matching key.static <TSource,TInner,TKey>
Enumerable<TSource>semiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, EqualityComparer<TKey> comparer)Returns elements ofouterfor which there is a member ofinnerwith a matching key.static <TSource> booleansequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second)Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.static <TSource> booleansequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second, EqualityComparer<TSource> comparer)Determines whether two sequences are equal by comparing their elements by using a specifiedEqualityComparer<TSource>.static <TSource> TSourcesingle(Enumerable<TSource> source)Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.static <TSource> TSourcesingle(Enumerable<TSource> source, Predicate1<TSource> predicate)Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.static <TSource> TSourcesingleOrDefault(Enumerable<TSource> source)Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.static <TSource> TSourcesingleOrDefault(Enumerable<TSource> source, Predicate1<TSource> predicate)Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.static <TSource> Enumerable<TSource>skip(Enumerable<TSource> source, int count)Bypasses a specified number of elements in a sequence and then returns the remaining elements.static <TSource> Enumerable<TSource>skipWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.static <TSource> Enumerable<TSource>skipWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.static <TSource> BigDecimalsum(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> doublesum(Enumerable<TSource> source, DoubleFunction1<TSource> selector)Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> floatsum(Enumerable<TSource> source, FloatFunction1<TSource> selector)Computes the sum of the sequence of Float values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> intsum(Enumerable<TSource> source, IntegerFunction1<TSource> selector)Computes the sum of the sequence of int values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> longsum(Enumerable<TSource> source, LongFunction1<TSource> selector)Computes the sum of the sequence of long values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> BigDecimalsum(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Doublesum(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Floatsum(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)Computes the sum of the sequence of nullable Float values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Integersum(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)Computes the sum of the sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Longsum(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)Computes the sum of the sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence.static <TSource> Enumerable<TSource>take(Enumerable<TSource> source, int count)Returns a specified number of contiguous elements from the start of a sequence.static <TSource> Enumerable<TSource>take(Enumerable<TSource> source, long count)Returns a specified number of contiguous elements from the start of a sequence.static <TSource> Enumerable<TSource>takeWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)Returns elements from a sequence as long as a specified condition is true.static <TSource> Enumerable<TSource>takeWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)Returns elements from a sequence as long as a specified condition is true.static <TSource> Enumerable<TSource>takeWhileLong(Enumerable<TSource> source, Predicate2<TSource,Long> predicate)Returns elements from a sequence as long as a specified condition is true.static <TSource,TKey extends Comparable<TKey>>
OrderedEnumerable<TSource>thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.static <TSource,TKey>
OrderedEnumerable<TSource>thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)Performs a subsequent ordering of the elements in a sequence in ascending order according to a key, using a specified comparator.static <TSource,TKey extends Comparable<TKey>>
OrderedEnumerable<TSource>thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)Performs a subsequent ordering of the elements in a sequence in descending order according to a key.static <TSource,TKey>
OrderedEnumerable<TSource>thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)Performs a subsequent ordering of the elements in a sequence in descending order according to a key, using a specified comparator.static <TSource,TInner,TResult>
Enumerable<TResult>thetaJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Predicate2<TSource,TInner> predicate, Function2<TSource,TInner,TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight)Correlates the elements of two sequences based on a predicate.static <TSource> List<TSource>toList(Enumerable<TSource> source)Creates aList<TSource>from anEnumerable<TSource>.static <TSource,TKey>
Lookup<TKey,TSource>toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)Creates a Lookup<TKey, TElement> from an Enumerable<TSource> according to a specified key selector function.static <TSource,TKey>
Lookup<TKey,TSource>toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to a specified key selector function and key comparer.static <TSource,TKey,TElement>
Lookup<TKey,TElement>toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to specified key selector and element selector functions.static <TSource,TKey,TElement>
Lookup<TKey,TElement>toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to a specified key selector function, a comparer and an element selector function.(package private) static <TSource,TKey,TElement>
LookupImpl<TKey,TElement>toLookup_(Map<TKey,List<TElement>> map, Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)static <TSource,TKey>
Map<TKey,TSource>toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)Creates a Map<TKey, TValue> from an Enumerable<TSource> according to a specified key selector function.static <TSource,TKey>
Map<TKey,TSource>toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)Creates aMap<TKey, TValue>from anEnumerable<TSource>according to a specified key selector function and key comparer.static <TSource,TKey,TElement>
Map<TKey,TElement>toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)Creates aMap<TKey, TValue>from anEnumerable<TSource>according to specified key selector and element selector functions.static <TSource,TKey,TElement>
Map<TKey,TElement>toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)Creates aMap<TKey, TValue>from anEnumerable<TSource>according to a specified key selector function, a comparer, and an element selector function.static <TSource> Enumerable<TSource>union(Enumerable<TSource> source0, Enumerable<TSource> source1)Produces the set union of two sequences by using the default equality comparer.static <TSource> Enumerable<TSource>union(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)Produces the set union of two sequences by using a specified EqualityComparer<TSource>.private static <TSource> Function1<EnumerableDefaults.Wrapped<TSource>,TSource>unwrapper()static <TSource> Enumerable<TSource>where(Enumerable<TSource> source, Predicate1<TSource> predicate)Filters a sequence of values based on a predicate.static <TSource> Enumerable<TSource>where(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)Filters a sequence of values based on a predicate.private static <TSource> Enumerator<TSource>where(Enumerator<TSource> enumerator, Predicate1<TSource> predicate)private static <TSource> Function1<TSource,EnumerableDefaults.Wrapped<TSource>>wrapperFor(EqualityComparer<TSource> comparer)static <T0,T1,TResult>
Enumerable<TResult>zip(Enumerable<T0> first, Enumerable<T1> second, Function2<T0,T1,TResult> resultSelector)Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
-
-
-
Method Detail
-
aggregate
public static <TSource> TSource aggregate(Enumerable<TSource> source, Function2<TSource,TSource,TSource> func)
Applies an accumulator function over a sequence.
-
aggregate
public static <TSource,TAccumulate> TAccumulate aggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
-
aggregate
public static <TSource,TAccumulate,TResult> TResult aggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func, Function1<TAccumulate,TResult> selector)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
-
all
public static <TSource> boolean all(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Determines whether all elements of a sequence satisfy a condition.
-
any
public static boolean any(Enumerable enumerable)
Determines whether a sequence contains any elements.
-
any
public static <TSource> boolean any(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Determines whether any element of a sequence satisfies a condition.
-
asEnumerable
public static <TSource> Enumerable<TSource> asEnumerable(Enumerable<TSource> enumerable)
Returns the input typed asEnumerable<TSource>.This method has no effect other than to change the compile-time type of source from a type that implements
Enumerable<TSource>toEnumerable<TSource>itself.AsEnumerable<TSource>(Enumerable<TSource>)can be used to choose between query implementations when a sequence implementsEnumerable<TSource>but also has a different set of public query methods available. For example, given a generic classTablethat implementsEnumerable<TSource>and has its own methods such aswhere,select, andselectMany, a call towherewould invoke the publicwheremethod ofTable. ATabletype that represents a database table could have awheremethod that takes the predicate argument as an expression tree and converts the tree to SQL for remote execution. If remote execution is not desired, for example because the predicate invokes a local method, theasEnumerable<TSource>method can be used to hide the custom methods and instead make the standard query operators available.
-
asQueryable
public static <TSource> Queryable<TSource> asQueryable(Enumerable<TSource> enumerable)
Converts an Enumerable to an IQueryable.Analogous to the LINQ's Enumerable.AsQueryable extension method.
- Type Parameters:
TSource- Element type- Parameters:
enumerable- Enumerable- Returns:
- A queryable
-
average
public static <TSource> BigDecimal average(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> BigDecimal average(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> double average(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> Double average(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> int average(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
Computes the average of a sequence of int values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> Integer average(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
Computes the average of a sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> long average(Enumerable<TSource> source, LongFunction1<TSource> selector)
Computes the average of a sequence of long values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> Long average(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
Computes the average of a sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> float average(Enumerable<TSource> source, FloatFunction1<TSource> selector)
Computes the average of a sequence of Float values that are obtained by invoking a transform function on each element of the input sequence.
-
average
public static <TSource> Float average(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
Computes the average of a sequence of nullable Float values that are obtained by invoking a transform function on each element of the input sequence.
-
cast
public static <TSource,T2> Enumerable<T2> cast(Enumerable<TSource> source, Class<T2> clazz)
Analogous to LINQ's Enumerable.Cast extension method.
- Type Parameters:
T2- Target type- Parameters:
clazz- Target type- Returns:
- Collection of T2
-
concat
public static <TSource> Enumerable<TSource> concat(Enumerable<TSource> enumerable0, Enumerable<TSource> enumerable1)
Concatenates two sequences.
-
contains
public static <TSource> boolean contains(Enumerable<TSource> enumerable, TSource element)
Determines whether a sequence contains a specified element by using the default equality comparer.
-
contains
public static <TSource> boolean contains(Enumerable<TSource> enumerable, TSource element, EqualityComparer<TSource> comparer)
Determines whether a sequence contains a specified element by using a specifiedEqualityComparer<TSource>.
-
count
public static <TSource> int count(Enumerable<TSource> enumerable)
Returns the number of elements in a sequence.
-
count
public static <TSource> int count(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns a number that represents how many elements in the specified sequence satisfy a condition.
-
defaultIfEmpty
public static <TSource> Enumerable<TSource> defaultIfEmpty(Enumerable<TSource> enumerable)
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
-
defaultIfEmpty
public static <TSource> Enumerable<TSource> defaultIfEmpty(Enumerable<TSource> enumerable, TSource value)
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
-
distinct
public static <TSource> Enumerable<TSource> distinct(Enumerable<TSource> enumerable)
Returns distinct elements from a sequence by using the defaultEqualityComparerto compare values.
-
distinct
public static <TSource> Enumerable<TSource> distinct(Enumerable<TSource> enumerable, EqualityComparer<TSource> comparer)
Returns distinct elements from a sequence by using a specifiedEqualityComparerto compare values.
-
elementAt
public static <TSource> TSource elementAt(Enumerable<TSource> enumerable, int index)
Returns the element at a specified index in a sequence.
-
elementAtOrDefault
public static <TSource> TSource elementAtOrDefault(Enumerable<TSource> enumerable, int index)
Returns the element at a specified index in a sequence or a default value if the index is out of range.
-
except
public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1)
Produces the set difference of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
-
except
public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
Produces the set difference of two sequences by using the specifiedEqualityComparer<TSource>to compare values.
-
first
public static <TSource> TSource first(Enumerable<TSource> enumerable)
Returns the first element of a sequence. (Defined by Enumerable.)
-
first
public static <TSource> TSource first(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns the first element in a sequence that satisfies a specified condition.
-
firstOrDefault
public static <TSource> TSource firstOrDefault(Enumerable<TSource> enumerable)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
-
firstOrDefault
public static <TSource> TSource firstOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
-
groupBy
public static <TSource,TKey> Enumerable<Grouping<TKey,TSource>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector)
Groups the elements of a sequence according to a specified key selector function.
-
groupBy
public static <TSource,TKey> Enumerable<Grouping<TKey,TSource>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.
-
groupBy
public static <TSource,TKey,TElement> Enumerable<Grouping<TKey,TElement>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.
-
groupBy
public static <TSource,TKey,TElement> Enumerable<Grouping<TKey,TElement>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
-
groupBy
public static <TSource,TKey,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
-
groupBy
public static <TSource,TKey,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector, EqualityComparer<TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer.
-
groupBy
public static <TSource,TKey,TElement,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, Function2<TKey,Enumerable<TElement>,TResult> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
-
groupBy
public static <TSource,TKey,TElement,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, Function2<TKey,Enumerable<TElement>,TResult> resultSelector, EqualityComparer<TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.
-
groupBy
public static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)
Groups the elements of a sequence according to a specified key selector function, initializing an accumulator for each group and adding to it each time an element with the same key is seen. Creates a result value from each accumulator and its key using a specified function.
-
groupByMultiple
public static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> groupByMultiple(Enumerable<TSource> enumerable, List<Function1<TSource,TKey>> keySelectors, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)
Groups the elements of a sequence according to a list of specified key selector functions, initializing an accumulator for each group and adding to it each time an element with the same key is seen. Creates a result value from each accumulator and its key using a specified function.This method exists to support SQL
GROUPING SETS. It does not correspond to any method inEnumerable.
-
groupBy
public static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector, EqualityComparer<TKey> comparer)
Groups the elements of a sequence according to a specified key selector function, initializing an accumulator for each group and adding to it each time an element with the same key is seen. Creates a result value from each accumulator and its key using a specified function. Key values are compared by using a specified comparer.
-
groupBy_
private static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> groupBy_(Map<TKey,TAccumulate> map, Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)
-
groupByMultiple_
private static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> groupByMultiple_(Map<TKey,TAccumulate> map, Enumerable<TSource> enumerable, List<Function1<TSource,TKey>> keySelectors, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector)
-
groupBy_
private static <TSource,TKey,TResult> Enumerable<TResult> groupBy_(Set<TKey> map, Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TKey,TResult> resultSelector)
-
groupJoin
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> groupJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,Enumerable<TInner>,TResult> resultSelector)
Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
-
groupJoin
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> groupJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,Enumerable<TInner>,TResult> resultSelector, EqualityComparer<TKey> comparer)
Correlates the elements of two sequences based on key equality and groups the results. A specifiedEqualityComparer<TSource>is used to compare keys.
-
intersect
public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1)
Produces the set intersection of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
-
intersect
public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
Produces the set intersection of two sequences by using the specifiedEqualityComparer<TSource>to compare values.
-
join
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
-
join
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer)
Correlates the elements of two sequences based on matching keys. A specifiedEqualityComparer<TSource>is used to compare keys.
-
join
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> join(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)
Correlates the elements of two sequences based on matching keys. A specifiedEqualityComparer<TSource>is used to compare keys.
-
join_
private static <TSource,TInner,TKey,TResult> Enumerable<TResult> join_(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)
Implementation of join that builds the right input and probes with the left.
-
correlateJoin
public static <TSource,TInner,TResult> Enumerable<TResult> correlateJoin(CorrelateJoinType joinType, Enumerable<TSource> outer, Function1<TSource,Enumerable<TInner>> inner, Function2<TSource,TInner,TResult> resultSelector)
Returns elements ofouterfor which there is a member ofinnerwith a matching key. A specifiedEqualityComparer<TSource>is used to compare keys.
-
last
public static <TSource> TSource last(Enumerable<TSource> enumerable)
Returns the last element of a sequence. (Defined by Enumerable.)
-
semiJoin
public static <TSource,TInner,TKey> Enumerable<TSource> semiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector)
Returns elements ofouterfor which there is a member ofinnerwith a matching key.
-
semiJoin
public static <TSource,TInner,TKey> Enumerable<TSource> semiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, EqualityComparer<TKey> comparer)
Returns elements ofouterfor which there is a member ofinnerwith a matching key. A specifiedEqualityComparer<TSource>is used to compare keys.
-
thetaJoin
public static <TSource,TInner,TResult> Enumerable<TResult> thetaJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Predicate2<TSource,TInner> predicate, Function2<TSource,TInner,TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight)
Correlates the elements of two sequences based on a predicate.
-
mergeJoin
public static <TSource,TInner,TKey extends Comparable<TKey>,TResult> Enumerable<TResult> mergeJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, boolean generateNullsOnLeft, boolean generateNullsOnRight)
Joins two inputs that are sorted on the key.
-
last
public static <TSource> TSource last(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns the last element of a sequence that satisfies a specified condition.
-
lastOrDefault
public static <TSource> TSource lastOrDefault(Enumerable<TSource> enumerable)
Returns the last element of a sequence, or a default value if the sequence contains no elements.
-
lastOrDefault
public static <TSource> TSource lastOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.
-
longCount
public static <TSource> long longCount(Enumerable<TSource> source)
Returns an long that represents the total number of elements in a sequence.
-
longCount
public static <TSource> long longCount(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
Returns an long that represents how many elements in a sequence satisfy a condition.
-
max
public static <TSource extends Comparable<TSource>> TSource max(Enumerable<TSource> source)
Returns the maximum value in a generic sequence.
-
max
public static <TSource> BigDecimal max(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum Decimal value.
-
max
public static <TSource> BigDecimal max(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.
-
max
public static <TSource> double max(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum Double value.
-
max
public static <TSource> Double max(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.
-
max
public static <TSource> int max(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum int value.
-
max
public static <TSource> Integer max(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable int value. (Defined by Enumerable.)
-
max
public static <TSource> long max(Enumerable<TSource> source, LongFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum long value.
-
max
public static <TSource> Long max(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable long value. (Defined by Enumerable.)
-
max
public static <TSource> float max(Enumerable<TSource> source, FloatFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum Float value.
-
max
public static <TSource> Float max(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable Float value.
-
max
public static <TSource,TResult extends Comparable<TResult>> TResult max(Enumerable<TSource> source, Function1<TSource,TResult> selector)
Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.
-
min
public static <TSource extends Comparable<TSource>> TSource min(Enumerable<TSource> source)
Returns the minimum value in a generic sequence.
-
minFunction
private static <TSource extends Comparable<TSource>> Function2<TSource,TSource,TSource> minFunction()
-
maxFunction
private static <TSource extends Comparable<TSource>> Function2<TSource,TSource,TSource> maxFunction()
-
min
public static <TSource> BigDecimal min(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum Decimal value.
-
min
public static <TSource> BigDecimal min(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.
-
min
public static <TSource> double min(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum Double value.
-
min
public static <TSource> Double min(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.
-
min
public static <TSource> int min(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum int value.
-
min
public static <TSource> Integer min(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable int value. (Defined by Enumerable.)
-
min
public static <TSource> long min(Enumerable<TSource> source, LongFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum long value.
-
min
public static <TSource> Long min(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable long value. (Defined by Enumerable.)
-
min
public static <TSource> float min(Enumerable<TSource> source, FloatFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum Float value.
-
min
public static <TSource> Float min(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable Float value.
-
min
public static <TSource,TResult extends Comparable<TResult>> TResult min(Enumerable<TSource> source, Function1<TSource,TResult> selector)
Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.
-
ofType
public static <TSource,TResult> Enumerable<TResult> ofType(Enumerable<TSource> enumerable, Class<TResult> clazz)
Filters the elements of an Enumerable based on a specified type.Analogous to LINQ's Enumerable.OfType extension method.
- Type Parameters:
TResult- Target type- Parameters:
clazz- Target type- Returns:
- Collection of T2
-
orderBy
public static <TSource,TKey extends Comparable> Enumerable<TSource> orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
Sorts the elements of a sequence in ascending order according to a key.
-
orderBy
public static <TSource,TKey> Enumerable<TSource> orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
Sorts the elements of a sequence in ascending order by using a specified comparer.
-
orderByDescending
public static <TSource,TKey extends Comparable> Enumerable<TSource> orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
Sorts the elements of a sequence in descending order according to a key.
-
orderByDescending
public static <TSource,TKey> Enumerable<TSource> orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
Sorts the elements of a sequence in descending order by using a specified comparer.
-
reverse
public static <TSource> Enumerable<TSource> reverse(Enumerable<TSource> source)
Inverts the order of the elements in a sequence.
-
select
public static <TSource,TResult> Enumerable<TResult> select(Enumerable<TSource> source, Function1<TSource,TResult> selector)
Projects each element of a sequence into a new form.
-
select
public static <TSource,TResult> Enumerable<TResult> select(Enumerable<TSource> source, Function2<TSource,Integer,TResult> selector)
Projects each element of a sequence into a new form by incorporating the element's index.
-
selectMany
public static <TSource,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TResult>> selector)
Projects each element of a sequence to anEnumerable<TSource>and flattens the resulting sequences into one sequence.
-
selectMany
public static <TSource,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TResult>> selector)
Projects each element of a sequence to anEnumerable<TSource>, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.
-
selectMany
public static <TSource,TCollection,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)
Projects each element of a sequence to anEnumerable<TSource>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.
-
selectMany
public static <TSource,TCollection,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)
Projects each element of a sequence to anEnumerable<TSource>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.
-
sequenceEqual
public static <TSource> boolean sequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second)
Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
-
sequenceEqual
public static <TSource> boolean sequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second, EqualityComparer<TSource> comparer)
Determines whether two sequences are equal by comparing their elements by using a specifiedEqualityComparer<TSource>.
-
single
public static <TSource> TSource single(Enumerable<TSource> source)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
-
single
public static <TSource> TSource single(Enumerable<TSource> source, Predicate1<TSource> predicate)
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
-
singleOrDefault
public static <TSource> TSource singleOrDefault(Enumerable<TSource> source)
Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
-
singleOrDefault
public static <TSource> TSource singleOrDefault(Enumerable<TSource> source, Predicate1<TSource> predicate)
Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
-
skip
public static <TSource> Enumerable<TSource> skip(Enumerable<TSource> source, int count)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
-
skipWhile
public static <TSource> Enumerable<TSource> skipWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
-
skipWhile
public static <TSource> Enumerable<TSource> skipWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.
-
sum
public static <TSource> BigDecimal sum(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> BigDecimal sum(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> double sum(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> Double sum(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> int sum(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
Computes the sum of the sequence of int values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> Integer sum(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
Computes the sum of the sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> long sum(Enumerable<TSource> source, LongFunction1<TSource> selector)
Computes the sum of the sequence of long values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> Long sum(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
Computes the sum of the sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> float sum(Enumerable<TSource> source, FloatFunction1<TSource> selector)
Computes the sum of the sequence of Float values that are obtained by invoking a transform function on each element of the input sequence.
-
sum
public static <TSource> Float sum(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
Computes the sum of the sequence of nullable Float values that are obtained by invoking a transform function on each element of the input sequence.
-
take
public static <TSource> Enumerable<TSource> take(Enumerable<TSource> source, int count)
Returns a specified number of contiguous elements from the start of a sequence.
-
take
public static <TSource> Enumerable<TSource> take(Enumerable<TSource> source, long count)
Returns a specified number of contiguous elements from the start of a sequence.
-
takeWhile
public static <TSource> Enumerable<TSource> takeWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)
Returns elements from a sequence as long as a specified condition is true.
-
takeWhile
public static <TSource> Enumerable<TSource> takeWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.
-
takeWhileLong
public static <TSource> Enumerable<TSource> takeWhileLong(Enumerable<TSource> source, Predicate2<TSource,Long> predicate)
Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.
-
createOrderedEnumerable
public static <TSource,TKey> OrderedEnumerable<TSource> createOrderedEnumerable(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator, boolean descending)
Performs a subsequent ordering of the elements in a sequence according to a key.
-
thenBy
public static <TSource,TKey extends Comparable<TKey>> OrderedEnumerable<TSource> thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
-
thenBy
public static <TSource,TKey> OrderedEnumerable<TSource> thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key, using a specified comparator.
-
thenByDescending
public static <TSource,TKey extends Comparable<TKey>> OrderedEnumerable<TSource> thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)
Performs a subsequent ordering of the elements in a sequence in descending order according to a key.
-
thenByDescending
public static <TSource,TKey> OrderedEnumerable<TSource> thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
Performs a subsequent ordering of the elements in a sequence in descending order according to a key, using a specified comparator.
-
toMap
public static <TSource,TKey> Map<TKey,TSource> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
Creates a Map<TKey, TValue> from an Enumerable<TSource> according to a specified key selector function.NOTE: Called
toDictionaryin LINQ.NET.
-
toMap
public static <TSource,TKey> Map<TKey,TSource> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
Creates aMap<TKey, TValue>from anEnumerable<TSource>according to a specified key selector function and key comparer.
-
toMap
public static <TSource,TKey,TElement> Map<TKey,TElement> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
Creates aMap<TKey, TValue>from anEnumerable<TSource>according to specified key selector and element selector functions.
-
toMap
public static <TSource,TKey,TElement> Map<TKey,TElement> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
Creates aMap<TKey, TValue>from anEnumerable<TSource>according to a specified key selector function, a comparer, and an element selector function.
-
toList
public static <TSource> List<TSource> toList(Enumerable<TSource> source)
Creates aList<TSource>from anEnumerable<TSource>.
-
toLookup
public static <TSource,TKey> Lookup<TKey,TSource> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
Creates a Lookup<TKey, TElement> from an Enumerable<TSource> according to a specified key selector function.
-
toLookup
public static <TSource,TKey> Lookup<TKey,TSource> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to a specified key selector function and key comparer.
-
toLookup
public static <TSource,TKey,TElement> Lookup<TKey,TElement> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to specified key selector and element selector functions.
-
toLookup_
static <TSource,TKey,TElement> LookupImpl<TKey,TElement> toLookup_(Map<TKey,List<TElement>> map, Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
-
toLookup
public static <TSource,TKey,TElement> Lookup<TKey,TElement> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
Creates aLookup<TKey, TElement>from anEnumerable<TSource>according to a specified key selector function, a comparer and an element selector function.
-
union
public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0, Enumerable<TSource> source1)
Produces the set union of two sequences by using the default equality comparer.
-
union
public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
Produces the set union of two sequences by using a specified EqualityComparer<TSource>.
-
unwrapper
private static <TSource> Function1<EnumerableDefaults.Wrapped<TSource>,TSource> unwrapper()
-
wrapperFor
private static <TSource> Function1<TSource,EnumerableDefaults.Wrapped<TSource>> wrapperFor(EqualityComparer<TSource> comparer)
-
where
public static <TSource> Enumerable<TSource> where(Enumerable<TSource> source, Predicate1<TSource> predicate)
Filters a sequence of values based on a predicate.
-
where
private static <TSource> Enumerator<TSource> where(Enumerator<TSource> enumerator, Predicate1<TSource> predicate)
-
where
public static <TSource> Enumerable<TSource> where(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
-
zip
public static <T0,T1,TResult> Enumerable<TResult> zip(Enumerable<T0> first, Enumerable<T1> second, Function2<T0,T1,TResult> resultSelector)
Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
-
asOrderedQueryable
public static <T> OrderedQueryable<T> asOrderedQueryable(Enumerable<T> source)
-
into
public static <T,C extends Collection<? super T>> C into(Enumerable<T> source, C sink)
Default implementation ofExtendedEnumerable.into(Collection).
-
remove
public static <T,C extends Collection<? super T>> C remove(Enumerable<T> source, C sink)
Default implementation ofExtendedEnumerable.removeAll(Collection).
-
-