/** * This method tests the "drop" method. * * @dataProvider data_drop */ public function test_drop(array $provided, array $expected) { $p0 = IArrayList\Type::make($provided[0], '\\Saber\\Data\\IInt32\\Type'); $p1 = IInt32\Type::box($provided[1]); $r0 = IArrayList\Module::drop($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 the first "n" items * in the array list and the second item contains the remainder. * * @access public * @static * @param IArrayList\Type $xs the array list * @param IInt32\Type $n the number of items to take * @return ITuple\Type the tuple */ public static function split(IArrayList\Type $xs, IInt32\Type $n) : ITuple\Type { return ITuple\Type::box2(IArrayList\Module::take($xs, $n), IArrayList\Module::drop($xs, $n)); }