Skip to content

Query Functions

Naoya Komatsu edited this page May 14, 2016 · 13 revisions

Restriction

where

  • where(bool predicate(T))

    Enumerable.from([10,20,30]).where("_ <= 20"); // => [10, 20]
  • where(bool predicate(T, int))

    Enumerable.from([10,20,30]).where("_2 > 1"); // => [30]
  • where(bool predicate(T, int, Args*), Args*)

distinct

skip

skipWhile

take

takeWhile

Projection

select

  • select(T2 selector(T))

    Enumerable.from([10,20,30]).select("_ * 2"); // => [20, 40, 60]
  • select(T2 selector(T, int))

    Enumerable.from([10,20,30]).select("_2 + ':' + _"); // => ["0:10", "1:20", "2:30"]
  • select(T2 selector(T, int, Args*), Args*)

selectMany

  • selectMany(T2[] collectionSelector(T))

    Enumerable.from([[10,20,30], [1,2]]).selectMany("_"); // => [10, 20, 30, 1, 2]
  • selectMany(T2[] collectionSelector(T, int))

    Enumerable.from([[10,20,30], [1,2]])
        .selectMany("_.insert(0, 'index:' + index), _");
    // => ["index:0", 10, 20, 30, "index:1", 1, 2]
  • selectMany(T2[](T) collectionSelector, T3 resultSelector(T, T2))

    Enumerable.from([
            %[ name:"a", data:[1,2] ],
            %[ name:"b", data:[10,20,30] ]
        ]).selectMany("_.data", "_.name + ':' + _2");
    // => ["a:1", "a:2", "b:10", "b:20", "b:30"]
  • selectMany(T2[](T, int) collectionSelector, T3 resultSelector(T, T2))

  • selectMany(T2[](T, int, Args*) collectionSelector, T3 resultSelector(T, T2, Args*), Args*)

scan

scanWithSeed

Concatenation

startWith

concat

zip

defaultIfEmpty

Join

innerJoin

outerJoin

groupJoin

Grouping

groupBy

buffer

Set operation

union

intersect

except

Sort

orderBy

orderByDescending

thenBy

thenByDescending

reverse

Element acquisition

elementAt

elementAtOrDefault

first

firstOrDefault

last

lastOrDefault

single

singleOrDefault

Aggregation

count

aggregate

aggregateWithSeed

average

max

min

sum

Judgement

indexOf

isEmpty

any

all

contains

sequenceEqual

Conversion

toArray

toString

toDictionary

toLookup

Other

forEach

Debug

trace

force

Clone this wiki locally