public function subList(\int $fromIndex, \int $toIndex, $fromInclusive = true, $toInclusive = false) { return $this->list->subList($fromIndex, $toIndex, $fromInclusive, $toInclusive); }
/** * Same as sort but for a specific range. */ public static function sortRange(ListI $list, \int $from, \int $to, \blaze\lang\Comparator $c = null) { $size = $list->count(); if ($size <= 0) { throw new \blaze\lang\IndexOutOfBoundsException('List has not any Values'); } if ($size <= $to || $to < 0) { throw new \blaze\lang\IndexOutOfBoundsException('size: ' . $size . ' to: ' . $to); } if ($size <= $from || $from < 0) { throw new \blaze\lang\IndexOutOfBoundsException('size: ' . $size . ' to: ' . $from); } $ar = $list->subList($from, $to, true, true); $ar = $ar->toArray(); if ($c === null) { usort($ar, array('\\blaze\\collections\\ComparableComparator', 'compare')); } else { usort($ar, array($c, 'compare')); } for ($i = $from; $i <= $to; $i++) { $list->set($i, $ar[$i]); } }