Exemplo n.º 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;
 }