/** * This method returns the current object. * * @access public * @final * @return mixed the current object */ public final function current() { return $this->xs->item($this->i); }
/** * This method compares the specified object with the current object for order. * * @access public * @static * @param IArrayList\Type $xs the left operand * @param IArrayList\Type $ys the object to be compared * @return ITrit\Type whether the current object is less than, * equal to, or greater than the specified * object */ public static function compare(IArrayList\Type $xs, IArrayList\Type $ys) : ITrit\Type { $xsl = $xs->length(); $ysl = $ys->length(); $length = IInt32\Module::min($xsl, $ysl); for ($i = IInt32\Type::zero(); IInt32\Module::lt($i, $length)->unbox(); $i = IInt32\Module::increment($i)) { $r = $xs->item($i)->compare($ys->item($i)); if ($r->unbox() != 0) { return $r; } } return ITrit\Type::box($xsl->unbox() <=> $ysl->unbox()); }