Пример #1
0
 /**
  * This method returns an iterator for this collection.
  *
  * @access public
  * @final
  * @return IArrayList\Iterator                              an iterator for this collection
  */
 public final function iterator() : IArrayList\Iterator
 {
     return IArrayList\Module::iterator($this->toArrayList());
 }
Пример #2
0
 /**
  * This method returns whether any of the items of the list evaluate to true.
  *
  * @access public
  * @static
  * @param IArrayList\Type $xs                               the left operand
  * @return IBool\Type                                       whether all of the items of
  *                                                          the list evaluate to false
  */
 public static function or_(IArrayList\Type $xs) : IBool\Type
 {
     return IArrayList\Module::any($xs, function (IBool\Type $x, IInt32\Type $i) : IBool\Type {
         return $x;
     });
 }
Пример #3
0
 /**
  * This method tests the "or" method.
  *
  * @dataProvider data_or
  */
 public function test_or(array $provided, array $expected)
 {
     $p0 = IArrayList\Type::make($provided[0], '\\Saber\\Data\\IBool\\Type');
     $r0 = IArrayList\Module::or_($p0);
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $r0);
     $this->assertSame($e0, $r0->unbox());
 }
Пример #4
0
 /**
  * This method returns the list as an array.
  *
  * @access public
  * @static
  * @param ILinkedList\Type $xs                              the operand
  * @return IArrayList\Type                                  the list as an array list
  */
 public static function toArrayList(ILinkedList\Type $xs) : IArrayList\Type
 {
     return ILinkedList\Module::foldLeft($xs, function (IArrayList\Type $c, Core\Type $x) {
         return IArrayList\Module::append($c, $x);
     }, IArrayList\Type::empty_());
 }