示例#1
0
文件: sources.py 项目: Degubi/Py-Seq
def array(): return Sequence.of([ 1, 2, 3 ])
def iterate(): return Sequence.iterate(0, lambda k: k + 1, lambda k: k < 5)
示例#2
0
文件: sources.py 项目: Degubi/Py-Seq
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))
示例#3
0
文件: sources.py 项目: Degubi/Py-Seq
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()
示例#4
0
文件: sources.py 项目: Degubi/Py-Seq
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)
示例#5
0
文件: sources.py 项目: Degubi/Py-Seq
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'])
示例#6
0
文件: sources.py 项目: Degubi/Py-Seq
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)
示例#7
0
文件: sources.py 项目: Degubi/Py-Seq
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)
示例#8
0
文件: sources.py 项目: Degubi/Py-Seq
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 })