Class DefaultEnumerable<T>

java.lang.Object
org.apache.calcite.linq4j.DefaultEnumerable<T>
Type Parameters:
T - Element type
All Implemented Interfaces:
Iterable<T>, Enumerable<T>, ExtendedEnumerable<T>, ExtendedOrderedEnumerable<T>, OrderedEnumerable<T>, RawEnumerable<T>
Direct Known Subclasses:
AbstractEnumerable, AbstractEnumerable2, AbstractQueryable, QueryableDefaults.ReplayableQueryable

public abstract class DefaultEnumerable<T> extends Object implements OrderedEnumerable<T>
Implementation of the Enumerable interface that implements the extension methods by calling into the Extensions class.

The are two abstract methods: RawEnumerable.enumerator() and Iterable.iterator(). The derived class can implement each separately, or implement one in terms of the other.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <TAccumulate>
    @PolyNull TAccumulate
    aggregate(@PolyNull TAccumulate seed, Function2<@PolyNull TAccumulate,T,@PolyNull TAccumulate> func)
    Applies an accumulator function over a sequence.
    @Nullable T
    aggregate(Function2<@Nullable T,T,T> func)
    Applies an accumulator function over a sequence.
    <TAccumulate, TResult>
    TResult
    aggregate(TAccumulate seed, Function2<TAccumulate,T,TAccumulate> func, Function1<TAccumulate,TResult> selector)
    Applies an accumulator function over a sequence.
    boolean
    all(Predicate1<T> predicate)
    Determines whether all elements of a sequence satisfy a condition.
    boolean
    any()
    Determines whether a sequence contains any elements.
    boolean
    any(Predicate1<T> predicate)
    Determines whether any element of a sequence satisfies a condition.
    Returns the input typed as Enumerable<TSource>.
    protected OrderedQueryable<T>
     
    Converts this Enumerable to a Queryable.
    Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
    double
    Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.
    float
    Computes the average of a sequence of Float values that are obtained by invoking a transform function on each element of the input sequence.
    int
    Computes the average of a sequence of int values that are obtained by invoking a transform function on each element of the input sequence.
    long
    average(LongFunction1<T> 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.
    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.
    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.
    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.
    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.
    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.
    <T2> Enumerable<T2>
    cast(Class<T2> clazz)
    Converts the elements of this Enumerable to the specified type.
    concat(Enumerable<T> enumerable1)
    Concatenates two sequences.
    boolean
    contains(T element)
    Determines whether a sequence contains a specified element by using the default equality comparer.
    boolean
    contains(T element, EqualityComparer<T> comparer)
    Determines whether a sequence contains a specified element by using a specified EqualityComparer<TSource>.
    <TInner, TResult>
    Enumerable<TResult>
    correlateJoin(JoinType joinType, Function1<T,Enumerable<TInner>> inner, Function2<T,TInner,TResult> resultSelector)
    For each row of the current enumerable returns the correlated rows from the inner enumerable (nested loops join).
    int
    Returns the number of elements in a sequence.
    int
    count(Predicate1<T> predicate)
    Returns a number that represents how many elements in the specified sequence satisfy a condition.
    createOrderedEnumerable(Function1<T,TKey> keySelector, Comparator<TKey> comparator, boolean descending)
    Performs a subsequent ordering of the elements in an OrderedEnumerable according to a key, using a specified comparator.
    Enumerable<@Nullable T>
    Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
    Enumerable<@PolyNull T>
    defaultIfEmpty(@PolyNull T value)
    Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
    Returns distinct elements from a sequence by using the default equality comparer to compare values.
    Returns distinct elements from a sequence by using a specified EqualityComparer<TSource> to compare values.
    elementAt(int index)
    Returns the element at a specified index in a sequence.
    @Nullable T
    elementAtOrDefault(int index)
    Returns the element at a specified index in a sequence or a default value if the index is out of range.
    except(Enumerable<T> enumerable1)
    Produces the set difference of two sequences by using the default equality comparer to compare values, eliminate duplicates.
    except(Enumerable<T> enumerable1, 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.
    except(Enumerable<T> enumerable1, EqualityComparer<T> comparer)
    Produces the set difference of two sequences by using the specified EqualityComparer<TSource> to compare values, eliminate duplicates.
    except(Enumerable<T> enumerable1, EqualityComparer<T> 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.
    Returns the first element of a sequence.
    first(Predicate1<T> predicate)
    Returns the first element in a sequence that satisfies a specified condition.
    @Nullable T
    Returns the first element of a sequence, or a default value if the sequence contains no elements.
    @Nullable T
    Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
    <R> @Nullable R
    foreach(Function1<T,R> func)
    Performs an operation for each member of this enumeration.
    protected Enumerable<T>
    Derived classes might wish to override this method to return the "outer" enumerable.
    protected OrderedEnumerable<T>
    Derived classes might wish to override this method to return the "outer" ordered-enumerable.
    <TKey> Enumerable<Grouping<TKey,T>>
    groupBy(Function1<T,TKey> keySelector)
    Groups the elements of a sequence according to a specified key selector function.
    <TKey> Enumerable<Grouping<TKey,T>>
    groupBy(Function1<T,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.
    <TKey, TAccumulate, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,T,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.
    <TKey, TAccumulate, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,T,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.
    <TKey, TElement>
    Enumerable<Grouping<TKey,TElement>>
    groupBy(Function1<T,TKey> keySelector, Function1<T,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.
    <TKey, TElement>
    Enumerable<Grouping<TKey,TElement>>
    groupBy(Function1<T,TKey> keySelector, Function1<T,TElement> elementSelector, EqualityComparer<TKey> comparer)
    Groups the elements of a sequence according to a key selector function.
    <TKey, TElement, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function1<T,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.
    <TKey, TElement, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function1<T,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.
    <TKey, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function2<TKey,Enumerable<T>,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.
    <TKey, TResult>
    Enumerable<TResult>
    groupBy(Function1<T,TKey> keySelector, Function2<TKey,Enumerable<T>,TResult> elementSelector, 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.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    groupJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,Enumerable<TInner>,TResult> resultSelector)
    Correlates the elements of two sequences based on equality of keys and groups the results.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    groupJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,Enumerable<TInner>,TResult> resultSelector, EqualityComparer<TKey> comparer)
    Correlates the elements of two sequences based on key equality and groups the results.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    hashJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,TInner,TResult> resultSelector)
    Correlates the elements of two sequences based on matching keys.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    hashJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer)
    Correlates the elements of two sequences based on matching keys.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    hashJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight)
    Correlates the elements of two sequences based on matching keys, with optional outer join semantics.
    <TInner, TKey, TResult>
    Enumerable<TResult>
    hashJoin(Enumerable<TInner> inner, Function1<T,TKey> outerKeySelector, Function1<TInner,TKey> innerKeySelector, Function2<T,TInner,TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight, @Nullable Predicate2<T,TInner> predicate)
    Correlates the elements of two sequences based on matching keys, with optional outer join semantics.
    intersect(Enumerable<T> enumerable1)
    Produces the set intersection of two sequences by using the default equality comparer to compare values, eliminate duplicates.
    intersect(Enumerable<T> enumerable1, 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.
    intersect(Enumerable<T> enumerable1, EqualityComparer<T> comparer)
    Produces the set intersection of two sequences by using the specified EqualityComparer<TSource> to compare values, eliminate duplicates.
    intersect(Enumerable<T> enumerable1, EqualityComparer<T> 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.
    <C extends Collection<? super T>>
    C
    into(C sink)
    Copies the contents of this sequence into a collection.
    Returns the last element of a sequence.
    last(Predicate1<T> predicate)
    Returns the last element of a sequence that satisfies a specified condition.
    @Nullable T
    Returns the last element of a sequence, or a default value if the sequence contains no elements.
    @Nullable T
    Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.
    long
    Returns an long that represents the total number of elements in a sequence.
    long
    longCount(Predicate1<T> predicate)
    Returns an long that represents how many elements in a sequence satisfy a condition.
    @Nullable T
    max()
    Returns the maximum value in a generic sequence.
    @Nullable BigDecimal
    Invokes a transform function on each element of a sequence and returns the maximum Decimal value.
    double
    max(DoubleFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the maximum Double value.
    float
    max(FloatFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the maximum Float value.
    <TResult extends Comparable<TResult>>
    @Nullable TResult
    max(Function1<T,TResult> selector)
    Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.
    int
    max(IntegerFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the maximum int value.
    long
    max(LongFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the maximum long value.
    @Nullable BigDecimal
    Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.
    @Nullable Double
    Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.
    @Nullable Float
    Invokes a transform function on each element of a sequence and returns the maximum nullable Float value.
    @Nullable Integer
    Invokes a transform function on each element of a sequence and returns the maximum nullable int value.
    @Nullable Long
    Invokes a transform function on each element of a sequence and returns the maximum nullable long value.
    @Nullable T
    min()
    Returns the minimum value in a generic sequence.
    @Nullable BigDecimal
    Invokes a transform function on each element of a sequence and returns the minimum Decimal value.
    double
    min(DoubleFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the minimum Double value.
    float
    min(FloatFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the minimum Float value.
    <TResult extends Comparable<TResult>>
    @Nullable TResult
    min(Function1<T,TResult> selector)
    Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.
    int
    min(IntegerFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the minimum int value.
    long
    min(LongFunction1<T> selector)
    Invokes a transform function on each element of a sequence and returns the minimum long value.
    @Nullable BigDecimal
    Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.
    @Nullable Double
    Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.
    @Nullable Float
    Invokes a transform function on each element of a sequence and returns the minimum nullable Float value.
    @Nullable Integer
    Invokes a transform function on each element of a sequence and returns the minimum nullable int value.
    @Nullable Long
    Invokes a transform function on each element of a sequence and returns the minimum nullable long value.
    <TResult> Enumerable<TResult>
    ofType(Class<TResult> clazz)
    Filters the elements of an Enumerable based on a specified type.
    <TKey extends Comparable>
    Enumerable<T>
    orderBy(Function1<T,TKey> keySelector)
    Sorts the elements of a sequence in ascending order according to a key.
    <TKey> Enumerable<T>
    orderBy(Function1<T,TKey> keySelector, Comparator<TKey> comparator)
    Sorts the elements of a sequence in ascending order by using a specified comparer.
    <TKey extends Comparable>
    Enumerable<T>
    orderByDescending(Function1<T,TKey> keySelector)
    Sorts the elements of a sequence in descending order according to a key.
    <TKey> Enumerable<T>
    orderByDescending(Function1<T,TKey> keySelector, Comparator<TKey> comparator)
    Sorts the elements of a sequence in descending order by using a specified comparer.
    <C extends Collection<? super T>>
    C
    removeAll(C sink)
    Removes the contents of this sequence from a collection.
    Inverts the order of the elements in a sequence.
    <TResult> Enumerable<TResult>
    select(Function1<T,TResult> selector)
    Projects each element of a sequence into a new form.
    <TResult> Enumerable<TResult>
    select(Function2<T,Integer,TResult> selector)
    Projects each element of a sequence into a new form by incorporating the element's index.
    <TCollection, TResult>
    Enumerable<TResult>
    selectMany(Function1<T,Enumerable<TCollection>> collectionSelector, Function2<T,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.
    <TResult> Enumerable<TResult>
    selectMany(Function1<T,Enumerable<TResult>> selector)
    Projects each element of a sequence to an Enumerable<TSource> and flattens the resulting sequences into one sequence.
    <TCollection, TResult>
    Enumerable<TResult>
    selectMany(Function2<T,Integer,Enumerable<TCollection>> collectionSelector, Function2<T,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.
    <TResult> Enumerable<TResult>
    selectMany(Function2<T,Integer,Enumerable<TResult>> selector)
    Projects each element of a sequence to an Enumerable<TSource>, and flattens the resulting sequences into one sequence.
    boolean
    sequenceEqual(Enumerable<T> enumerable1)
    Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
    boolean
    sequenceEqual(Enumerable<T> enumerable1, EqualityComparer<T> comparer)
    Determines whether two sequences are equal by comparing their elements by using a specified EqualityComparer<TSource>.
    Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
    single(Predicate1<T> predicate)
    Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
    @Nullable T
    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.
    @Nullable T
    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(int count)
    Bypasses a specified number of elements in a sequence and then returns the remaining elements.
    skipWhile(Predicate1<T> predicate)
    Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
    Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
    <TKey, TAccumulate, TResult>
    Enumerable<TResult>
    sortedGroupBy(Function1<T,TKey> keySelector, Function0<TAccumulate> accumulatorInitializer, Function2<TAccumulate,T,TAccumulate> accumulatorAdder, Function2<TKey,TAccumulate,TResult> resultSelector, Comparator<TKey> comparator)
    Group keys are sorted already.
    Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.
    double
    sum(DoubleFunction1<T> 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.
    float
    sum(FloatFunction1<T> 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.
    int
    sum(IntegerFunction1<T> 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.
    long
    sum(LongFunction1<T> 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.
    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.
    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.
    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.
    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.
    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.
    take(int count)
    Returns a specified number of contiguous elements from the start of a sequence.
    takeWhile(Predicate1<T> predicate)
    Returns elements from a sequence as long as a specified condition is true.
    Returns elements from a sequence as long as a specified condition is true.
    <TKey extends Comparable<TKey>>
    OrderedEnumerable<T>
    thenBy(Function1<T,TKey> keySelector)
    Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
    thenBy(Function1<T,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.
    <TKey extends Comparable<TKey>>
    OrderedEnumerable<T>
    thenByDescending(Function1<T,TKey> keySelector)
    Performs a subsequent ordering of the elements in a sequence in descending order according to a key.
    thenByDescending(Function1<T,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.
    Creates a List<TSource> from an Enumerable<TSource>.
    <TKey> Lookup<TKey,T>
    toLookup(Function1<T,TKey> keySelector)
    Creates a Lookup<TKey, TElement> from an Enumerable<TSource> according to a specified key selector function.
    <TKey> Lookup<TKey,T>
    toLookup(Function1<T,TKey> keySelector, EqualityComparer<TKey> comparer)
    Creates a Lookup<TKey, TElement> from an Enumerable<TSource> according to a specified key selector function and key comparer.
    <TKey, TElement>
    Lookup<TKey,TElement>
    toLookup(Function1<T,TKey> keySelector, Function1<T,TElement> elementSelector)
    Creates a Lookup<TKey, TElement> from an Enumerable<TSource> according to specified key selector and element selector functions.
    <TKey, TElement>
    Lookup<TKey,TElement>
    toLookup(Function1<T,TKey> keySelector, Function1<T,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.
    <TKey> Map<TKey,T>
    toMap(Function1<T,TKey> keySelector)
    Creates a Map<TKey, TValue> from an Enumerable<TSource> according to a specified key selector function.
    <TKey> Map<TKey,T>
    toMap(Function1<T,TKey> keySelector, EqualityComparer<TKey> comparer)
    Creates a Map<TKey, TValue> from an Enumerable<TSource> according to a specified key selector function and key comparer.
    <TKey, TElement>
    Map<TKey,TElement>
    toMap(Function1<T,TKey> keySelector, Function1<T,TElement> elementSelector)
    Creates a Map<TKey, TValue> from an Enumerable<TSource> according to specified key selector and element selector functions.
    <TKey, TElement>
    Map<TKey,TElement>
    toMap(Function1<T,TKey> keySelector, Function1<T,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.
    union(Enumerable<T> source1)
    Produces the set union of two sequences by using the default equality comparer.
    union(Enumerable<T> source1, EqualityComparer<T> comparer)
    Produces the set union of two sequences by using a specified EqualityComparer<TSource>.
    where(Predicate1<T> predicate)
    Filters a sequence of values based on a predicate.
    where(Predicate2<T,Integer> predicate)
    Filters a sequence of values based on a predicate.
    <T1, TResult>
    Enumerable<TResult>
    zip(Enumerable<T1> source1, Function2<T,T1,TResult> resultSelector)
    Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface org.apache.calcite.linq4j.RawEnumerable

    enumerator