Provides a set of static methods for querying objects that implement ienumerable <type_t>.
Public Aliases | |
using | enumerable_type = enumerable_t |
Represents the ienumerable enumerable type. | |
using | source_type = source_t |
Represents the ienumerable source type. | |
template<class type_t > | |
using | ienumerable = typename xtd::linq::enumerable::ienumerable< type_t > |
Represents the ienumerable value type. | |
template<class type_t > | |
using | list = typename xtd::linq::enumerable::list< type_t > |
Represents the list value type. | |
Public Static Methods | |
source_t | aggregate (const std::function< source_t(const source_t &, const source_t &)> &func) const |
Applies an accumulator function over a sequence. | |
source_t | aggregate (const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. | |
template<class accumulate_t > | |
accumulate_t | aggregate (const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. | |
source_t | aggregate (const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func, const std::function< source_t(const source_t &)> &result_selector) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. | |
template<class result_t , class accumulate_t > | |
result_t | aggregate (const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. | |
bool | all (const std::function< bool(const source_t &)> &predicate) const |
Determines whether all elements of a sequence satisfy a condition. | |
bool | any () const noexcept |
Determines whether a sequence contains any elements. | |
bool | any (const std::function< bool(const source_t &)> &predicate) const |
Determines whether any element of a sequence satisfies a condition. | |
const ienumerable< source_t > & | append (const source_t &element) const noexcept |
Appends a value to the end of the sequence. | |
const ienumerable< source_t > & | as_enumerable () const noexcept |
Returns the input typed as xtd::collections::generic::ienumerable <type_t>. | |
auto | average () const noexcept |
Computes the average of a sequence of source_t values. | |
template<class result_t > | |
const ienumerable< result_t > & | cast () const noexcept |
Casts the elements of an xtd::collections::generic::ienumerable to the specified type. | |
const ienumerable< xtd::array< source_t > > & | chunk (size_t size) const |
Splits the elements of a sequence into chunks of size at most size. | |
const ienumerable< source_t > & | concat (const ienumerable< source_t > &second) const noexcept |
Concatenates two sequences. | |
bool | contains (const source_t &value) const noexcept |
Determines whether a sequence contains a specified element by using the default equality comparer. | |
bool | contains (const source_t &value, const xtd::collections::generic::iequality_comparer< source_t > &comparer) const noexcept |
Determines whether a sequence contains a specified element by using a specified equality comparer. | |
size_t | count () const noexcept |
Returns the number of elements in current sequence. | |
size_t | count (const std::function< bool(const source_t &)> &predicate) const noexcept |
Returns a number that represents how many elements in the specified sequence satisfy a condition. | |
xtd::size | count (const source_t &value) const noexcept |
Returns the number of elements with the specified value. | |
template<class key_t > | |
const ienumerable< key_value_pair< key_t, xtd::size > > & | count_by (const std::function< key_t(const source_t &)> &key_selector) const noexcept |
Returns the count of elements in the current sequence grouped by key. | |
template<class key_t > | |
const ienumerable< key_value_pair< key_t, xtd::size > > & | count_by (const std::function< key_t(const source_t &)> &key_selector, const iequality_comparer< key_t > &key_comparer) const noexcept |
Returns the count of elements in the current sequence grouped by key. | |
const ienumerable< source_t > & | default_if_empty () const noexcept |
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
const ienumerable< source_t > & | default_if_empty (const source_t &default_value) const noexcept |
Returns the elements of the specified sequence or the specified value in a singleton collection if the current sequence is empty. | |
source_t | first_or_default (const std::function< bool(const source_t &)> &predicate, const source_t &default_value) const noexcept |
Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
source_t | first_or_default (const std::function< bool(const source_t &)> &predicate) const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
source_t | first_or_default (const source_t default_value) const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
source_t | first_or_default () const noexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. | |
template<class result_t > | |
const ienumerable< result_t > & | select (const std::function< result_t(const source_t &)> &selector) const |
Projects each element of a sequence into a new form. | |
const ienumerable< source_t > & | select (const std::function< source_t(const source_t &)> &selector) const |
Projects each element of a sequence into a new form. | |
template<class result_t > | |
const ienumerable< result_t > & | select (const std::function< result_t(const source_t &, size_t index)> &selector) const |
Projects each element of a sequence into a new form by incorporating the element's index. | |
const ienumerable< source_t > & | select (const std::function< source_t(const source_t &, size_t index)> &selector) const |
Projects each element of a sequence into a new form by incorporating the element's index. | |
const list< source_t > & | to_list () const noexcept |
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
const ienumerable< source_t > & | where (const std::function< bool(const source_t &)> &predicate) const |
Filters a sequence of values based on a predicate. | |
const ienumerable< source_t > & | where (const std::function< bool(const source_t &, size_t)> &predicate) const |
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. | |
using xtd::collections::generic::extensions::enumerable< enumerable_t, source_t >::enumerable_type = enumerable_t |
Represents the ienumerable enumerable type.
using xtd::collections::generic::extensions::enumerable< enumerable_t, source_t >::source_type = source_t |
Represents the ienumerable source type.
using xtd::collections::generic::extensions::enumerable< enumerable_t, source_t >::ienumerable = typename xtd::linq::enumerable::ienumerable<type_t> |
Represents the ienumerable value type.
using xtd::collections::generic::extensions::enumerable< enumerable_t, source_t >::list = typename xtd::linq::enumerable::list<type_t> |
Represents the list value type.
|
inline |
Applies an accumulator function over a sequence.
func | An accumulator function to be invoked on each element. |
|
inline |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
seed | The initial accumulator value. |
func | An accumulator function to be invoked on each element. |
|
inline |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
accumulate_t | The type of the accumulator value. |
seed | The initial accumulator value. |
func | An accumulator function to be invoked on each element. |
|
inline |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
seed | The initial accumulator value. |
func | An accumulator function to be invoked on each element. |
result_Selector | A function to transform the final accumulator value into the result value. |
|
inline |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
result_t | The type of the resulting value. |
accumulate_t | The type of the accumulator value. |
seed | The initial accumulator value. |
func | An accumulator function to be invoked on each element. |
result_Selector | A function to transform the final accumulator value into the result value. |
|
inline |
Determines whether all elements of a sequence satisfy a condition.
predicate | A function to test each element for a condition. |
true
if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false
. true
if all the pet names start with "B" or if the pets array is empty.
|
inlinenoexcept |
Determines whether a sequence contains any elements.
true
if the source sequence contains any elements; otherwise, false
.
|
inline |
Determines whether any element of a sequence satisfies a condition.
predicate | A function to test each element for a condition. |
true
if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false
. true
if all the pet names start with "B" or if the pets array is empty.
|
inlinenoexcept |
Appends a value to the end of the sequence.
element | The value to append to source. |
|
inlinenoexcept |
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
|
inlinenoexcept |
Computes the average of a sequence of source_t values.
xtd::invalid_operation_exception | this sequence contains no elements. |
|
inlinenoexcept |
Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
result_t | The type of the resulting value. |
xtd::invalid_cast_exception | An element in the sequence cannot be cast to type `result_t`. |
|
inline |
Splits the elements of a sequence into chunks of size at most size.
source_t | The type of the elements of source. |
source | A sequence of values to chunk. |
size | The maximum size of each chunk. |
|
inlinenoexcept |
Concatenates two sequences.
second | The sequence to concatenate to the current sequence. |
|
inlinenoexcept |
Determines whether a sequence contains a specified element by using the default equality comparer.
value | The value to locate in the sequence. |
true
if the source sequence contains an element that has the specified value; otherwise, false
.
|
inlinenoexcept |
Determines whether a sequence contains a specified element by using a specified equality comparer.
value | The value to locate in the sequence. |
comparer | An equality comparer to compare values. |
true
if the source sequence contains an element that has the specified value; otherwise, false
.
|
inlinenoexcept |
Returns the number of elements in current sequence.
|
inlinenoexcept |
Returns a number that represents how many elements in the specified sequence satisfy a condition.
predicate | A function to test each element for a condition. |
|
inlinenoexcept |
Returns the number of elements with the specified value.
value | The value to search for. |
value
.
|
inlinenoexcept |
Returns the count of elements in the current sequence grouped by key.
key_t | The type of the key returned by key_selector . |
key_selector | A function to extract the key for each element. |
|
inlinenoexcept |
Returns the count of elements in the current sequence grouped by key.
key_t | The type of the key returned by key_selector . |
key_selector | A function to extract the key for each element. |
key_comparer | An equality comparer to compare keys. |
|
inlinenoexcept |
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty.
|
inlinenoexcept |
Returns the elements of the specified sequence or the specified value in a singleton collection if the current sequence is empty.
default_value | The value to return if the sequence is empty. |
|
inlinenoexcept |
Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found.
predicate | A function to test each element for a condition. |
default_value | The default value to return if the sequence is empty. |
default_value
if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.
|
inlinenoexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
predicate | A function to test each element for a condition. |
source_t {}
if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.
|
inlinenoexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
default_value | The default value to return if the sequence is empty. |
default_value
if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.
|
inlinenoexcept |
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
source_t {}
if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.
|
inline |
Projects each element of a sequence into a new form.
result_t | The type of the resulting value. |
source | A sequence of values to invoke a transform function on. |
selector | A transform function to apply to each element. |
|
inline |
Projects each element of a sequence into a new form.
source | A sequence of values to invoke a transform function on. |
selector | A transform function to apply to each element. |
|
inline |
Projects each element of a sequence into a new form by incorporating the element's index.
result_t | The type of the resulting value. |
source | A sequence of values to invoke a transform function on. |
selector | A transform function to apply to each source element; the second parameter of the function represents the index of the source element. |
|
inline |
Projects each element of a sequence into a new form by incorporating the element's index.
source | A sequence of values to invoke a transform function on. |
selector | A transform function to apply to each source element; the second parameter of the function represents the index of the source element. |
|
noexcept |
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>.
|
inline |
Filters a sequence of values based on a predicate.
predicate | A function to test each element for a condition. |
|
inline |
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
predicate | A function to test each source element for a condition; the second parameter of the function represents the index of the source element. |