public abstract class EnumerableDefaults extends Object
Enumerable interface.| Constructor and Description |
|---|
EnumerableDefaults() |
| Modifier and Type | Method and Description |
|---|---|
static <TSource> TSource |
aggregate(Enumerable<TSource> source,
Function2<TSource,TSource,TSource> func)
Applies an accumulator function over a sequence.
|
static <TSource,TAccumulate> |
aggregate(Enumerable<TSource> source,
TAccumulate seed,
Function2<TAccumulate,TSource,TAccumulate> func)
Applies an accumulator function over a
sequence.
|
static <TSource,TAccumulate,TResult> |
aggregate(Enumerable<TSource> source,
TAccumulate seed,
Function2<TAccumulate,TSource,TAccumulate> func,
Function1<TAccumulate,TResult> selector)
Applies an accumulator function over a
sequence.
|
static <TSource> boolean |
all(Enumerable<TSource> enumerable,
Predicate1<TSource> predicate)
Determines whether all elements of a sequence
satisfy a condition.
|
static <TSource,TInner,TKey> |
antiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector)
Returns elements of
outer for which there is NOT a member of
inner with a matching key. |
static <TSource,TInner,TKey> |
antiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
EqualityComparer<TKey> comparer) |
static <TSource,TInner,TKey> |
antiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
EqualityComparer<TKey> comparer,
Predicate2<TSource,TInner> nonEquiPredicate) |
static boolean |
any(Enumerable enumerable)
Determines whether a sequence contains any
elements.
|
static <TSource> boolean |
any(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 as
Enumerable<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> 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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
static <TSource,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> boolean |
contains(Enumerable<TSource> enumerable,
TSource element)
Determines whether a sequence contains a specified
element by using the default equality comparer.
|
static <TSource> boolean |
contains(Enumerable<TSource> enumerable,
TSource element,
EqualityComparer<TSource> comparer)
Determines whether a sequence contains a specified
element by using a specified
EqualityComparer<TSource>. |
static <TSource,TInner,TResult> |
correlateBatchJoin(JoinType joinType,
Enumerable<TSource> outer,
Function1<List<TSource>,Enumerable<TInner>> inner,
Function2<TSource,TInner,TResult> resultSelector,
Predicate2<TSource,TInner> predicate,
int batchSize)
Fetches blocks of size
batchSize from outer,
storing each block into a list (outerValues). |
static <TSource,TInner,TResult> |
correlateJoin(JoinType joinType,
Enumerable<TSource> outer,
Function1<TSource,Enumerable<TInner>> inner,
Function2<TSource,? super TInner,TResult> resultSelector)
For each row of the
outer enumerable returns the correlated rows
from the inner enumerable. |
static <TSource> int |
count(Enumerable<TSource> enumerable)
Returns the number of elements in a
sequence.
|
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.
|
static <TSource,TKey> |
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 default
EqualityComparer to compare values. |
static <TSource> Enumerable<TSource> |
distinct(Enumerable<TSource> enumerable,
EqualityComparer<TSource> comparer)
Returns distinct elements from a sequence by using
a specified
EqualityComparer to compare values. |
static <TSource> TSource |
elementAt(Enumerable<TSource> enumerable,
int index)
Returns the element at a specified index in a
sequence.
|
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.
|
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,
eliminate duplicates.
|
static <TSource> Enumerable<TSource> |
except(Enumerable<TSource> source0,
Enumerable<TSource> source1,
boolean all)
Produces the set difference of two sequences by
using the default equality comparer to compare values,
using
all to indicate whether to eliminate duplicates. |
static <TSource> Enumerable<TSource> |
except(Enumerable<TSource> source0,
Enumerable<TSource> source1,
EqualityComparer<TSource> comparer)
Produces the set difference of two sequences by
using the specified
EqualityComparer<TSource> to compare
values, eliminate duplicates. |
static <TSource> Enumerable<TSource> |
except(Enumerable<TSource> source0,
Enumerable<TSource> source1,
EqualityComparer<TSource> comparer,
boolean all)
Produces the set difference of two sequences by
using the specified
EqualityComparer<TSource> to compare
values, using all to indicate whether to eliminate duplicates. |
static <TSource> TSource |
first(Enumerable<TSource> enumerable)
Returns the first element of a sequence.
|
static <TSource> TSource |
first(Enumerable<TSource> enumerable,
Predicate1<TSource> predicate)
Returns the first element in a sequence that
satisfies a specified condition.
|
static <TSource> TSource |
firstOrDefault(Enumerable<TSource> enumerable)
Returns the first element of a sequence, or a
default value if the sequence contains no elements.
|
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.
|
static <TSource,TKey> |
groupBy(Enumerable<TSource> enumerable,
Function1<TSource,TKey> keySelector)
Groups the elements of a sequence according to a
specified key selector function.
|
static <TSource,TKey> |
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> |
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> |
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> |
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> |
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> |
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> |
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> |
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> |
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.
|
static <TSource,TKey,TAccumulate,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.
|
static <TSource,TInner,TKey,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> |
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,TInner,TKey,TResult> |
hashJoin(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> |
hashJoin(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> |
hashJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
Function2<TSource,TInner,TResult> resultSelector,
@Nullable EqualityComparer<TKey> comparer,
boolean generateNullsOnLeft,
boolean generateNullsOnRight)
Correlates the elements of two sequences based on
matching keys.
|
static <TSource,TInner,TKey,TResult> |
hashJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
Function2<TSource,TInner,TResult> resultSelector,
@Nullable EqualityComparer<TKey> comparer,
boolean generateNullsOnLeft,
boolean generateNullsOnRight,
@Nullable Predicate2<TSource,TInner> predicate)
Correlates the elements of two sequences based on
matching keys.
|
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,
eliminate duplicates.(Defined by Enumerable.)
|
static <TSource> Enumerable<TSource> |
intersect(Enumerable<TSource> source0,
Enumerable<TSource> source1,
boolean all)
Produces the set intersection of two sequences by
using the default equality comparer to compare values,
using
all to indicate whether to eliminate duplicates. |
static <TSource> Enumerable<TSource> |
intersect(Enumerable<TSource> source0,
Enumerable<TSource> source1,
EqualityComparer<TSource> comparer)
Produces the set intersection of two sequences by
using the specified
EqualityComparer<TSource> to compare
values, eliminate duplicates. |
static <TSource> Enumerable<TSource> |
intersect(Enumerable<TSource> source0,
Enumerable<TSource> source1,
EqualityComparer<TSource> comparer,
boolean all)
Produces the set intersection of two sequences by
using the specified
EqualityComparer<TSource> to compare
values, using all to indicate whether to eliminate duplicates. |
static <T,C extends Collection<? super T>> |
into(Enumerable<T> source,
C sink)
Default implementation of
ExtendedEnumerable.into(Collection). |
static boolean |
isMergeJoinSupported(JoinType joinType)
Returns if certain join type is supported by Enumerable Merge Join implementation.
|
static <TSource> TSource |
last(Enumerable<TSource> enumerable)
Returns the last element of a sequence.
|
static <TSource> TSource |
last(Enumerable<TSource> enumerable,
Predicate1<TSource> predicate)
Returns the last element of a sequence that
satisfies a specified condition.
|
static <TSource> TSource |
lastOrDefault(Enumerable<TSource> enumerable)
Returns the last element of a sequence, or a
default value if the sequence contains no elements.
|
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.
|
static <TSource> Enumerable<TSource> |
lazyCollectionSpool(Collection<TSource> outputCollection,
Enumerable<TSource> input)
Lazy read and lazy write spool that stores data into a collection.
|
static <TSource> long |
longCount(Enumerable<TSource> source)
Returns an long that represents the total number
of elements in a sequence.
|
static <TSource> long |
longCount(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>> |
max(Enumerable<TSource> source)
Returns the maximum value in a generic
sequence.
|
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.
|
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.
|
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.
|
static <TSource,TResult extends Comparable<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.
|
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.
|
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.
|
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.
|
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.
|
static <TSource> @Nullable 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.
|
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.
|
static <TSource> @Nullable 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.
|
static <TSource,TInner,TKey extends Comparable<TKey>,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)
|
static <TSource,TInner,TKey extends Comparable<TKey>,TResult> |
mergeJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
Function2<TSource,TInner,TResult> resultSelector,
JoinType joinType,
Comparator<TKey> comparator)
Joins two inputs that are sorted on the key.
|
static <TSource,TInner,TKey extends Comparable<TKey>,TResult> |
mergeJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
@Nullable Predicate2<TSource,TInner> extraPredicate,
Function2<TSource,TInner,TResult> resultSelector,
JoinType joinType,
@Nullable Comparator<TKey> comparator)
Joins two inputs that are sorted on the key, with an extra predicate for non equi-join
conditions.
|
static <TSource,TKey> |
mergeUnion(List<Enumerable<TSource>> sources,
Function1<TSource,TKey> sortKeySelector,
Comparator<TKey> sortComparator,
boolean all,
EqualityComparer<TSource> equalityComparer)
Merge Union Enumerable.
|
static <TSource extends Comparable<TSource>> |
min(Enumerable<TSource> source)
Returns the minimum value in a generic
sequence.
|
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.
|
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.
|
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.
|
static <TSource,TResult extends Comparable<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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
static <TSource,TInner,TResult> |
nestedLoopJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Predicate2<TSource,TInner> predicate,
Function2<? super TSource,? super TInner,TResult> resultSelector,
JoinType joinType)
Correlates the elements of two sequences based on a predicate.
|
static <TSource,TResult> |
ofType(Enumerable<TSource> enumerable,
Class<TResult> clazz)
Filters the elements of an Enumerable based on a
specified type.
|
static <TSource,TKey extends Comparable> |
orderBy(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector)
Sorts the elements of a sequence in ascending
order according to a key.
|
static <TSource,TKey> |
orderBy(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
@Nullable Comparator<TKey> comparator)
Sorts the elements of a sequence in ascending
order by using a specified comparer.
|
static <TSource,TKey> |
orderBy(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
Comparator<TKey> comparator,
int offset,
int fetch)
A sort implementation optimized for a sort with a fetch size (LIMIT).
|
static <TSource,TKey extends Comparable> |
orderByDescending(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector)
Sorts the elements of a sequence in descending
order according to a key.
|
static <TSource,TKey> |
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>> |
remove(Enumerable<T> source,
C sink)
Default implementation of
ExtendedEnumerable.removeAll(Collection). |
static <TSource> Enumerable<TSource> |
repeatUnion(Enumerable<TSource> seed,
Enumerable<TSource> iteration,
int iterationLimit,
boolean all,
EqualityComparer<TSource> comparer)
Repeat Union enumerable.
|
static <TSource> Enumerable<TSource> |
reverse(Enumerable<TSource> source)
Inverts the order of the elements in a
sequence.
|
static <TSource,TResult> |
select(Enumerable<TSource> source,
Function1<TSource,TResult> selector)
Projects each element of a sequence into a new form.
|
static <TSource,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> |
selectMany(Enumerable<TSource> source,
Function1<TSource,Enumerable<TCollection>> collectionSelector,
Function2<TSource,TCollection,TResult> resultSelector)
Projects each element of a sequence to an
Enumerable<TSource>, flattens the resulting sequences into one
sequence, and invokes a result selector function on each
element therein. |
static <TSource,TResult> |
selectMany(Enumerable<TSource> source,
Function1<TSource,Enumerable<TResult>> selector)
Projects each element of a sequence to an
Enumerable<TSource> and flattens the resulting sequences into one
sequence. |
static <TSource,TCollection,TResult> |
selectMany(Enumerable<TSource> source,
Function2<TSource,Integer,Enumerable<TCollection>> collectionSelector,
Function2<TSource,TCollection,TResult> resultSelector)
Projects each element of a sequence to an
Enumerable<TSource>, flattens the resulting sequences into one
sequence, and invokes a result selector function on each
element therein. |
static <TSource,TResult> |
selectMany(Enumerable<TSource> source,
Function2<TSource,Integer,Enumerable<TResult>> selector)
Projects each element of a sequence to an
Enumerable<TSource>, and flattens the resulting sequences into one
sequence. |
static <TSource,TInner,TKey> |
semiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector)
Returns elements of
outer for which there is a member of
inner with a matching key. |
static <TSource,TInner,TKey> |
semiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
EqualityComparer<TKey> comparer) |
static <TSource,TInner,TKey> |
semiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
EqualityComparer<TKey> comparer,
boolean anti,
Predicate2<TSource,TInner> nonEquiPredicate)
Returns elements of
outer for which there is (semi-join) / is not (anti-semi-join)
a member of inner with a matching key. |
static <TSource,TInner,TKey> |
semiJoin(Enumerable<TSource> outer,
Enumerable<TInner> inner,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
EqualityComparer<TKey> comparer,
Predicate2<TSource,TInner> nonEquiPredicate) |
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.
|
static <TSource> boolean |
sequenceEqual(Enumerable<TSource> first,
Enumerable<TSource> second,
@Nullable EqualityComparer<TSource> comparer)
Determines whether two sequences are equal by
comparing their elements by using a specified
EqualityComparer<TSource>. |
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.
|
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.
|
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.
|
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.
|
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,TKey,TAccumulate,TResult> |
sortedGroupBy(Enumerable<TSource> enumerable,
Function1<TSource,TKey> keySelector,
Function0<TAccumulate> accumulatorInitializer,
Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder,
Function2<TKey,TAccumulate,TResult> resultSelector,
Comparator<TKey> comparator)
Group keys are sorted already.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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>> |
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> |
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>> |
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> |
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> List<TSource> |
toList(Enumerable<TSource> source)
Creates a
List<TSource> from an Enumerable<TSource>. |
static <TSource,TKey> |
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> |
toLookup(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
EqualityComparer<TKey> comparer)
Creates a
Lookup<TKey, TElement> from an
Enumerable<TSource> according to a specified key selector function
and key comparer. |
static <TSource,TKey,TElement> |
toLookup(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
Function1<TSource,TElement> elementSelector)
Creates a
Lookup<TKey, TElement> from an
Enumerable<TSource> according to specified key selector and element
selector functions. |
static <TSource,TKey,TElement> |
toLookup(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
Function1<TSource,TElement> elementSelector,
EqualityComparer<TKey> comparer)
Creates a
Lookup<TKey, TElement> from an
Enumerable<TSource> according to a specified key selector function,
a comparer and an element selector function. |
static <TSource,TKey> |
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> |
toMap(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
EqualityComparer<TKey> comparer)
Creates a
Map<TKey, TValue> from an
Enumerable<TSource> according to a specified key selector function
and key comparer. |
static <TSource,TKey,TElement> |
toMap(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
Function1<TSource,TElement> elementSelector)
Creates a
Map<TKey, TValue> from an
Enumerable<TSource> according to specified key selector and element
selector functions. |
static <TSource,TKey,TElement> |
toMap(Enumerable<TSource> source,
Function1<TSource,TKey> keySelector,
Function1<TSource,TElement> elementSelector,
EqualityComparer<TKey> comparer)
Creates a
Map<TKey, TValue> from an
Enumerable<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>.
|
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.
|
static <T0,T1,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.
|
public static <TSource> TSource aggregate(Enumerable<TSource> source, Function2<TSource,TSource,TSource> func)
public static <TSource,TAccumulate> TAccumulate aggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func)
public static <TSource,TAccumulate,TResult> TResult aggregate(Enumerable<TSource> source, TAccumulate seed, Function2<TAccumulate,TSource,TAccumulate> func, Function1<TAccumulate,TResult> selector)
public static <TSource> boolean all(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static boolean any(Enumerable enumerable)
public static <TSource> boolean any(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> asEnumerable(Enumerable<TSource> enumerable)
Enumerable<TSource>.
This method has no effect other than to change the compile-time type of
source from a type that implements Enumerable<TSource> to
Enumerable<TSource> itself.
AsEnumerable<TSource>(Enumerable<TSource>) can be used to choose
between query implementations when a sequence implements
Enumerable<TSource> but also has a different set of public query
methods available. For example, given a generic class Table that
implements Enumerable<TSource> and has its own methods such as
where, select, and selectMany, a call to
where would invoke the public where method of
Table. A Table type that represents a database table could
have a where method 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, the asEnumerable<TSource> method can be used to
hide the custom methods and instead make the standard query operators
available.
public static <TSource> Queryable<TSource> asQueryable(Enumerable<TSource> enumerable)
Analogous to the LINQ's Enumerable.AsQueryable extension method.
TSource - Element typeenumerable - Enumerablepublic static <TSource> BigDecimal average(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
public static <TSource> BigDecimal average(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
public static <TSource> double average(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
public static <TSource> Double average(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
public static <TSource> int average(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
public static <TSource> Integer average(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
public static <TSource> long average(Enumerable<TSource> source, LongFunction1<TSource> selector)
public static <TSource> Long average(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
public static <TSource> float average(Enumerable<TSource> source, FloatFunction1<TSource> selector)
public static <TSource> Float average(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
public static <TSource,T2> Enumerable<T2> cast(Enumerable<TSource> source, Class<T2> clazz)
Analogous to LINQ's Enumerable.Cast extension method.
T2 - Target typeclazz - Target typepublic static <TSource> Enumerable<TSource> concat(Enumerable<TSource> enumerable0, Enumerable<TSource> enumerable1)
public static <TSource> boolean contains(Enumerable<TSource> enumerable, TSource element)
public static <TSource> boolean contains(Enumerable<TSource> enumerable, TSource element, EqualityComparer<TSource> comparer)
EqualityComparer<TSource>.public static <TSource> int count(Enumerable<TSource> enumerable)
public static <TSource> int count(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> defaultIfEmpty(Enumerable<TSource> enumerable)
public static <TSource> Enumerable<TSource> defaultIfEmpty(Enumerable<TSource> enumerable, TSource value)
If value is not null, the result is never null.
public static <TSource> Enumerable<TSource> distinct(Enumerable<TSource> enumerable)
EqualityComparer to compare values.public static <TSource> Enumerable<TSource> distinct(Enumerable<TSource> enumerable, EqualityComparer<TSource> comparer)
EqualityComparer to compare values.public static <TSource> TSource elementAt(Enumerable<TSource> enumerable, int index)
public static <TSource> TSource elementAtOrDefault(Enumerable<TSource> enumerable, int index)
public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1)
public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1, boolean all)
all to indicate whether to eliminate duplicates.
(Defined by Enumerable.)public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
EqualityComparer<TSource> to compare
values, eliminate duplicates.public static <TSource> Enumerable<TSource> except(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer, boolean all)
EqualityComparer<TSource> to compare
values, using all to indicate whether to eliminate duplicates.public static <TSource> TSource first(Enumerable<TSource> enumerable)
public static <TSource> TSource first(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource> TSource firstOrDefault(Enumerable<TSource> enumerable)
public static <TSource> TSource firstOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource,TKey> Enumerable<Grouping<TKey,TSource>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> Enumerable<Grouping<TKey,TSource>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
public static <TSource,TKey,TElement> Enumerable<Grouping<TKey,TElement>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
public static <TSource,TKey,TElement> Enumerable<Grouping<TKey,TElement>> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
public static <TSource,TKey,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector)
public static <TSource,TKey,TResult> Enumerable<TResult> groupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function2<TKey,Enumerable<TSource>,TResult> resultSelector, EqualityComparer<TKey> comparer)
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)
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)
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)
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)
This method exists to support SQL GROUPING SETS.
It does not correspond to any method in Enumerable.
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)
public static <TSource,TKey,TAccumulate,TResult> Enumerable<TResult> sortedGroupBy(Enumerable<TSource> enumerable, Function1<TSource,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,TSource,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector, Comparator<TKey> comparator)
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)
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)
EqualityComparer<TSource> is used to compare keys.public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1)
public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1, boolean all)
all to indicate whether to eliminate duplicates.
(Defined by Enumerable.)public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
EqualityComparer<TSource> to compare
values, eliminate duplicates.public static <TSource> Enumerable<TSource> intersect(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer, boolean all)
EqualityComparer<TSource> to compare
values, using all to indicate whether to eliminate duplicates.public static <TSource,TInner,TKey,TResult> Enumerable<TResult> hashJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector)
public static <TSource,TInner,TKey,TResult> Enumerable<TResult> hashJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer)
EqualityComparer<TSource> is used to
compare keys.public static <TSource,TInner,TKey,TResult> Enumerable<TResult> hashJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, @Nullable EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)
EqualityComparer<TSource> is used to
compare keys.public static <TSource,TInner,TKey,TResult> Enumerable<TResult> hashJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<TSource,TInner,TResult> resultSelector, @Nullable EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight, @Nullable Predicate2<TSource,TInner> predicate)
EqualityComparer<TSource> is used to
compare keys.A predicate is used to filter the join result per-row.public static <TSource,TInner,TResult> Enumerable<TResult> correlateJoin(JoinType joinType, Enumerable<TSource> outer, Function1<TSource,Enumerable<TInner>> inner, Function2<TSource,? super TInner,TResult> resultSelector)
outer enumerable returns the correlated rows
from the inner enumerable.public static <TSource> TSource last(Enumerable<TSource> enumerable)
public static <TSource,TInner,TResult> Enumerable<TResult> correlateBatchJoin(JoinType joinType, Enumerable<TSource> outer, Function1<List<TSource>,Enumerable<TInner>> inner, Function2<TSource,TInner,TResult> resultSelector, Predicate2<TSource,TInner> predicate, int batchSize)
Fetches blocks of size batchSize from outer,
storing each block into a list (outerValues).
For each block, it uses the inner function to
obtain an enumerable with the correlated rows from the right (inner) input.
Each result present in the innerEnumerator has matched at least one
value from the block outerValues.
At this point a mini nested loop is performed between the outer values
and inner values using the predicate to find out the actual matching join results.
In order to optimize this mini nested loop, during the first iteration
(the first value from outerValues) we use the innerEnumerator
to compare it to inner rows, and at the same time we fill a list (innerValues)
with said innerEnumerator rows. In the subsequent iterations
(2nd, 3rd, etc. value from outerValues) the list innerValues is used,
since it contains all the innerEnumerator values,
which were stored in the first iteration.
public static <TSource,TInner,TKey> Enumerable<TSource> semiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector)
outer for which there is a member of
inner with a matching key.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)
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, Predicate2<TSource,TInner> nonEquiPredicate)
public static <TSource,TInner,TKey> Enumerable<TSource> antiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector)
outer for which there is NOT a member of
inner with a matching key.public static <TSource,TInner,TKey> Enumerable<TSource> antiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, EqualityComparer<TKey> comparer)
public static <TSource,TInner,TKey> Enumerable<TSource> antiJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, EqualityComparer<TKey> comparer, Predicate2<TSource,TInner> nonEquiPredicate)
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, boolean anti, Predicate2<TSource,TInner> nonEquiPredicate)
outer for which there is (semi-join) / is not (anti-semi-join)
a member of inner with a matching key. A specified
EqualityComparer<TSource> is used to compare keys.
A predicate is used to filter the join result per-row.public static <TSource,TInner,TResult> Enumerable<TResult> nestedLoopJoin(Enumerable<TSource> outer, Enumerable<TInner> inner, Predicate2<TSource,TInner> predicate, Function2<? super TSource,? super TInner,TResult> resultSelector, JoinType joinType)
@Deprecated 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)
mergeJoin(Enumerable, Enumerable, Function1, Function1, Function2, JoinType, Comparator)public static boolean isMergeJoinSupported(JoinType joinType)
NOTE: This method is subject to change or be removed without notice.
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, JoinType joinType, Comparator<TKey> comparator)
@API(since="1.23",
status=EXPERIMENTAL)
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,
@Nullable Predicate2<TSource,TInner> extraPredicate,
Function2<TSource,TInner,TResult> resultSelector,
JoinType joinType,
@Nullable Comparator<TKey> comparator)
extraPredicate - predicate for non equi-join conditions. In case of equi-join,
it will be null. In case of non-equi join, the non-equi conditions
will be evaluated using this extra predicate within the join process,
and not applying a filter on top of the join results, because the latter
strategy can only work on inner joins, and we aim to support other join
types in the future (e.g. semi or anti joins).comparator - key comparator, possibly null (in which case Comparable.compareTo(T)
will be used).
NOTE: The current API is experimental and subject to change without notice.public static <TSource> TSource last(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource> TSource lastOrDefault(Enumerable<TSource> enumerable)
public static <TSource> TSource lastOrDefault(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource> long longCount(Enumerable<TSource> source)
public static <TSource> long longCount(Enumerable<TSource> enumerable, Predicate1<TSource> predicate)
public static <TSource extends Comparable<TSource>> TSource max(Enumerable<TSource> source)
public static <TSource> BigDecimal max(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
public static <TSource> BigDecimal max(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
public static <TSource> double max(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
public static <TSource> Double max(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
public static <TSource> int max(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
public static <TSource> Integer max(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
public static <TSource> long max(Enumerable<TSource> source, LongFunction1<TSource> selector)
public static <TSource> @Nullable Long max(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
public static <TSource> float max(Enumerable<TSource> source, FloatFunction1<TSource> selector)
public static <TSource> @Nullable Float max(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
public static <TSource,TResult extends Comparable<TResult>> TResult max(Enumerable<TSource> source, Function1<TSource,TResult> selector)
public static <TSource extends Comparable<TSource>> TSource min(Enumerable<TSource> source)
public static <TSource> BigDecimal min(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
public static <TSource> BigDecimal min(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
public static <TSource> double min(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
public static <TSource> Double min(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
public static <TSource> int min(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
public static <TSource> Integer min(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
public static <TSource> long min(Enumerable<TSource> source, LongFunction1<TSource> selector)
public static <TSource> Long min(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
public static <TSource> float min(Enumerable<TSource> source, FloatFunction1<TSource> selector)
public static <TSource> Float min(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
public static <TSource,TResult extends Comparable<TResult>> TResult min(Enumerable<TSource> source, Function1<TSource,TResult> selector)
public static <TSource,TResult> Enumerable<TResult> ofType(Enumerable<TSource> enumerable, Class<TResult> clazz)
Analogous to LINQ's Enumerable.OfType extension method.
TResult - Target typeclazz - Target typepublic static <TSource,TKey extends Comparable> Enumerable<TSource> orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> Enumerable<TSource> orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, @Nullable Comparator<TKey> comparator)
public static <TSource,TKey> Enumerable<TSource> orderBy(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator, int offset, int fetch)
offset - how many rows are skipped from the sorted output.
Must be greater than or equal to 0.fetch - how many rows are retrieved. Must be greater than or equal to 0.public static <TSource,TKey extends Comparable> Enumerable<TSource> orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> Enumerable<TSource> orderByDescending(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
public static <TSource> Enumerable<TSource> reverse(Enumerable<TSource> source)
public static <TSource,TResult> Enumerable<TResult> select(Enumerable<TSource> source, Function1<TSource,TResult> selector)
public static <TSource,TResult> Enumerable<TResult> select(Enumerable<TSource> source, Function2<TSource,Integer,TResult> selector)
public static <TSource,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TResult>> selector)
Enumerable<TSource> and flattens the resulting sequences into one
sequence.public static <TSource,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TResult>> selector)
Enumerable<TSource>, and flattens the resulting sequences into one
sequence. The index of each source element is used in the
projected form of that element.public static <TSource,TCollection,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function2<TSource,Integer,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)
Enumerable<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.public static <TSource,TCollection,TResult> Enumerable<TResult> selectMany(Enumerable<TSource> source, Function1<TSource,Enumerable<TCollection>> collectionSelector, Function2<TSource,TCollection,TResult> resultSelector)
Enumerable<TSource>, flattens the resulting sequences into one
sequence, and invokes a result selector function on each
element therein.public static <TSource> boolean sequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second)
public static <TSource> boolean sequenceEqual(Enumerable<TSource> first, Enumerable<TSource> second, @Nullable EqualityComparer<TSource> comparer)
EqualityComparer<TSource>.public static <TSource> TSource single(Enumerable<TSource> source)
public static <TSource> TSource single(Enumerable<TSource> source, Predicate1<TSource> predicate)
public static <TSource> TSource singleOrDefault(Enumerable<TSource> source)
public static <TSource> TSource singleOrDefault(Enumerable<TSource> source, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> skip(Enumerable<TSource> source, int count)
public static <TSource> Enumerable<TSource> skipWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> skipWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
public static <TSource> BigDecimal sum(Enumerable<TSource> source, BigDecimalFunction1<TSource> selector)
public static <TSource> BigDecimal sum(Enumerable<TSource> source, NullableBigDecimalFunction1<TSource> selector)
public static <TSource> double sum(Enumerable<TSource> source, DoubleFunction1<TSource> selector)
public static <TSource> Double sum(Enumerable<TSource> source, NullableDoubleFunction1<TSource> selector)
public static <TSource> int sum(Enumerable<TSource> source, IntegerFunction1<TSource> selector)
public static <TSource> Integer sum(Enumerable<TSource> source, NullableIntegerFunction1<TSource> selector)
public static <TSource> long sum(Enumerable<TSource> source, LongFunction1<TSource> selector)
public static <TSource> Long sum(Enumerable<TSource> source, NullableLongFunction1<TSource> selector)
public static <TSource> float sum(Enumerable<TSource> source, FloatFunction1<TSource> selector)
public static <TSource> Float sum(Enumerable<TSource> source, NullableFloatFunction1<TSource> selector)
public static <TSource> Enumerable<TSource> take(Enumerable<TSource> source, int count)
public static <TSource> Enumerable<TSource> take(Enumerable<TSource> source, long count)
public static <TSource> Enumerable<TSource> takeWhile(Enumerable<TSource> source, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> takeWhile(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
public static <TSource> Enumerable<TSource> takeWhileLong(Enumerable<TSource> source, Predicate2<TSource,Long> predicate)
public static <TSource,TKey> OrderedEnumerable<TSource> createOrderedEnumerable(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator, boolean descending)
public static <TSource,TKey extends Comparable<TKey>> OrderedEnumerable<TSource> thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> OrderedEnumerable<TSource> thenBy(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
public static <TSource,TKey extends Comparable<TKey>> OrderedEnumerable<TSource> thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> OrderedEnumerable<TSource> thenByDescending(OrderedEnumerable<TSource> source, Function1<TSource,TKey> keySelector, Comparator<TKey> comparator)
public static <TSource,TKey> Map<TKey,TSource> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
NOTE: Called toDictionary in LINQ.NET.
public static <TSource,TKey> Map<TKey,TSource> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
Map<TKey, TValue> from an
Enumerable<TSource> according to a specified key selector function
and key comparer.public static <TSource,TKey,TElement> Map<TKey,TElement> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
Map<TKey, TValue> from an
Enumerable<TSource> according to specified key selector and element
selector functions.public static <TSource,TKey,TElement> Map<TKey,TElement> toMap(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
Map<TKey, TValue> from an
Enumerable<TSource> according to a specified key selector function,
a comparer, and an element selector function.public static <TSource> List<TSource> toList(Enumerable<TSource> source)
List<TSource> from an Enumerable<TSource>.public static <TSource,TKey> Lookup<TKey,TSource> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector)
public static <TSource,TKey> Lookup<TKey,TSource> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, EqualityComparer<TKey> comparer)
Lookup<TKey, TElement> from an
Enumerable<TSource> according to a specified key selector function
and key comparer.public static <TSource,TKey,TElement> Lookup<TKey,TElement> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector)
Lookup<TKey, TElement> from an
Enumerable<TSource> according to specified key selector and element
selector functions.public static <TSource,TKey,TElement> Lookup<TKey,TElement> toLookup(Enumerable<TSource> source, Function1<TSource,TKey> keySelector, Function1<TSource,TElement> elementSelector, EqualityComparer<TKey> comparer)
Lookup<TKey, TElement> from an
Enumerable<TSource> according to a specified key selector function,
a comparer and an element selector function.public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0, Enumerable<TSource> source1)
public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0, Enumerable<TSource> source1, EqualityComparer<TSource> comparer)
public static <TSource> Enumerable<TSource> where(Enumerable<TSource> source, Predicate1<TSource> predicate)
public static <TSource> Enumerable<TSource> where(Enumerable<TSource> source, Predicate2<TSource,Integer> predicate)
public static <T0,T1,TResult> Enumerable<TResult> zip(Enumerable<T0> first, Enumerable<T1> second, Function2<T0,T1,TResult> resultSelector)
public static <T> OrderedQueryable<T> asOrderedQueryable(Enumerable<T> source)
public static <T,C extends Collection<? super T>> C into(Enumerable<T> source, C sink)
ExtendedEnumerable.into(Collection).public static <T,C extends Collection<? super T>> C remove(Enumerable<T> source, C sink)
ExtendedEnumerable.removeAll(Collection).public static <TSource> Enumerable<TSource> repeatUnion(Enumerable<TSource> seed, Enumerable<TSource> iteration, int iterationLimit, boolean all, EqualityComparer<TSource> comparer)
TSource - record typeseed - seed enumerableiteration - iteration enumerableiterationLimit - maximum numbers of repetitions for the iteration enumerable
(negative value means no limit)all - whether duplicates will be considered or notcomparer - EqualityComparer to control duplicates,
only used if all is falsepublic static <TSource> Enumerable<TSource> lazyCollectionSpool(Collection<TSource> outputCollection, Enumerable<TSource> input)
public static <TSource,TKey> Enumerable<TSource> mergeUnion(List<Enumerable<TSource>> sources, Function1<TSource,TKey> sortKeySelector, Comparator<TKey> sortComparator, boolean all, EqualityComparer<TSource> equalityComparer)
TSource - record typeTKey - sort keysources - input enumerables (must be already sorted)sortKeySelector - sort key selectorsortComparator - sort comparator to decide the next itemall - whether duplicates will be considered or notequalityComparer - EqualityComparer to control duplicates,
only used if all is falseCopyright © 2012-2021 Apache Software Foundation. All Rights Reserved.