/** * This method tests the "dropWhile" method. * * @dataProvider data_dropWhile */ public function test_dropWhile(array $provided, array $expected) { $p0 = IArrayList\Type::make($provided[0], '\\Saber\\Data\\IInt32\\Type'); $p1 = $provided[1]; $r0 = IArrayList\Module::dropWhile($p0, $p1); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IArrayList\\Type', $r0); $this->assertSame($e0, $r0->unbox(1)); }
/** * This method returns a tuple where the first item contains longest prefix of the array * list that satisfies the predicate and the second item contains the remainder. * * @access public * @static * @param IArrayList\Type $xs the array list * @param callable $predicate the predicate function to be used * @return ITuple\Type the tuple */ public static function span(IArrayList\Type $xs, callable $predicate) : ITuple\Type { return ITuple\Type::box2(IArrayList\Module::takeWhile($xs, $predicate), IArrayList\Module::dropWhile($xs, $predicate)); }