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