示例#1
0
 public function testFlatten()
 {
     $seq = new Sequence();
     $seq->addAll([new Some('a'), new Some('b'), None::create(), new Some('c')]);
     $this->assertEquals(['a', 'b', 'c'], iterator_to_array($seq->flatten()));
     $seq = new Sequence();
     $seq->addAll([[1, 2, 3, 4], [5, 6], [7]]);
     $this->assertEquals([1, 2, 3, 4, 5, 6, 7], iterator_to_array($seq->flatten()));
 }