예제 #1
0
 /**
  * This method returns the collection as a linked list.
  *
  * @access public
  * @static
  * @param IString\Type $xs                                  the operand
  * @return ILinkedList\Type                                 the collection as a linked list
  */
 public static function toLinkedList(IString\Type $xs) : ILinkedList\Type
 {
     $length = $xs->length();
     $zs = ILinkedList\Type::nil();
     for ($i = IInt32\Module::decrement($length); IInt32\Module::ge($i, IInt32\Type::zero())->unbox(); $i = IInt32\Module::decrement($i)) {
         $zs = ILinkedList\Type::cons($xs->item($i), $zs);
     }
     return $zs;
 }
예제 #2
0
 /**
  * This method returns the current object.
  *
  * @access public
  * @final
  * @return mixed                                            the current object
  */
 public final function current()
 {
     return $this->xs->item($this->i);
 }