Beispiel #1
0
def array(): return Sequence.of([ 1, 2, 3 ])
def iterate(): return Sequence.iterate(0, lambda k: k + 1, lambda k: k < 5)
Beispiel #2
0
def distinctNumbers(): return Sequence.of(0, 2, 2, 0, 5, 10, 2, 5).distinct()
def distinctObjects(): return Sequence.of('asd', 'sad', 'lal', 'a', 'c', 'ba').distinct(lambda k: len(k))
Beispiel #3
0
def distinctObjects(): return Sequence.of('asd', 'sad', 'lal', 'a', 'c', 'ba').distinct(lambda k: len(k))
def descendingNumbers(): return Sequence.range(0, 5).sort_descending()
Beispiel #4
0
def flatMap(): return Sequence.of([{ 'data': [ 1, 2, 3 ] }, { 'data': [ 4, 5, 6 ] }]).flat_map(lambda k: k['data'])
def take(): return Sequence.iterate(0, lambda k: k + 2).take(6)
Beispiel #5
0
def map(): return Sequence.of(0, 2, 4).map(lambda k: k * 2)
def flatMap(): return Sequence.of([{ 'data': [ 1, 2, 3 ] }, { 'data': [ 4, 5, 6 ] }]).flat_map(lambda k: k['data'])
Beispiel #6
0
def filter(): return Sequence.of(0, 1, 2, 3, 4, 5).filter(lambda k: k % 2 == 0)
def map(): return Sequence.of(0, 2, 4).map(lambda k: k * 2)
Beispiel #7
0
def ofObjects(): return Sequence.of({ 'prop1': 'asd', 'prop2': 50 }, { 'prop1': 'asd', 'prop2': 20 }, { 'prop1': 'kek', 'prop2': 10 })
def filter(): return Sequence.of(0, 1, 2, 3, 4, 5).filter(lambda k: k % 2 == 0)
Beispiel #8
0
def of(): return Sequence.of(0, 1, 2, 3)
def ofObjects(): return Sequence.of({ 'prop1': 'asd', 'prop2': 50 }, { 'prop1': 'asd', 'prop2': 20 }, { 'prop1': 'kek', 'prop2': 10 })