/** * This method tests the "last" method. * * @dataProvider data_last */ public function test_last(array $provided, array $expected) { $p0 = IArrayList\Type::make($provided[0], '\\Saber\\Data\\IInt32\\Type'); $r0 = IArrayList\Module::last($p0); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IInt32\\Type', $r0); $this->assertSame($e0, $r0->unbox()); }
/** * This method returns an option using the last for the boxed object. * * @access public * @static * @param IArrayList\Type $xs the left operand * @return IOption\Type the option */ public static function lastOption(IArrayList\Type $xs) : IOption\Type { return $xs->__isEmpty() ? IOption\Type::none() : IOption\Type::some(IArrayList\Module::last($xs)); }