Syntax: select (selectorValue {(v, k) ==> result} [, selectorKey {(v, k) ==> result}])
This projection method requires the transform functions, selectorValue and selectorKey, to produce one key-value pair for each value in the source sequence. If selectorValue returns a value that is itself a collection, it is up to the consumer to traverse the subsequences manually. In such a situation, it might be better for your query to return a single coalesced sequence of values. To achieve this, use the {@link selectMany()} method instead of select. Although selectMany works similarly to select, it differs in that the transform function returns a collection that is then expanded by selectMany before it is returned.
public select ( callable $selectorValue, callable | null $selectorKey = null ) : |
||
$selectorValue | callable | {(v, k) ==> value} A transform function to apply to each value. |
$selectorKey | callable | null | {(v, k) ==> key} A transform function to apply to each key. Default: key. |
return | A sequence whose elements are the result of invoking the transform functions on each element of source. |