Reverses a sequence of elements.
@param array      Array containing the sequence
@param first      Beginning of the range
@param last       One past the end of the range
@exception        ArrayIndexOutOfBoundsException If the range
is invalid.
184565
private static void reverse(int first, int last, Swapper swapper) {
	// no more needed since manually inlined
	while (first < --last) {
		swapper.swap(first++,last);
	}
}
1072818
private function array_reverse_iterator (array $a, $preserveKeys = false)
  {
    if ($preserveKeys)
      for (end ($a); ($key = key ($a)) !== null; prev ($a))
        yield $key => current ($a);
    else for (end ($a); ($key = key ($a)) !== null; prev ($a))
      yield current ($a);
  }
564932
public static <E extends Comparable<E>> void sort(E[] array) {
        int minIndex = 0;
        for(int i = 0; i < array.length; i++) {
            minIndex = i;
            
            for(int j = minIndex; j < array.length; j++) {
                if(array[j].compareTo(array[minIndex]) < 0) {
                    minIndex = j;
                }
            }
            TrivialSwap.swap(array, i, minIndex);
        }
    }
880574
private boolean setPrevious(byte[] sequence, int start, int length) {
    if (previous == null || previous.length < length) {
      previous = new byte[length];
    }

    System.arraycopy(sequence, start, previous, 0, length);
    previousLength = length;
    return true;
  }
171366
public void reverseInplace() {
    for (int i = 0; i < this.size / 2; i++) {
      boolean temp = this.elements[i];
      this.elements[i] = this.elements[this.size - i - 1];
      this.elements[this.size() - i - 1] = temp;
    }
  }
606109
private void sort(final T[] array, int start, int end, Comparator<T> lt) {
    if (start == end)
      return;
    if ((end - start) <= 15)
      this.selectionSort(array, start, end, lt);
    else {
      final T pivot = array[start + ((end - start) / 2)];
      T tmp;
      int i = start - 1;
      int j = end;
      while (true) {
        do
          i++;
        while (lt.compare(array[i], pivot) < 0);
        do
          j--;
        while (lt.compare(pivot, array[j]) < 0);
        if (i >= j)
          break;
        tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
      }
      this.sort(array, start, i, lt);
      this.sort(array, i, end, lt);
    }
  }
343362
@SuppressWarnings("unchecked")
	protected <C extends Compound> Sequence<C> reverseSequence(Sequence<C> sequence) {
		if(getStrand() != Strand.NEGATIVE) {
			return sequence;
		}

		Sequence<C> reversed = new ReversedSequenceView<C>(sequence);
		// "safe" operation as we have tried to check this
		if(canComplement(sequence)) {
			Sequence<ComplementCompound> casted = (Sequence<ComplementCompound>) reversed;
			ComplementSequenceView<ComplementCompound> complement =
					new ComplementSequenceView<ComplementCompound>(casted);
			return (Sequence<C>)complement;
		}
		return reversed;
	}
562585
public static void sortReverse(double[] keys, int[] values, int start, int end) {
    quickSortReverse(keys, values, start, end);
  }
337178
@Override
    public void rewind(int count) throws IOException
    {
        if (count < 0)
        {
            throw new IllegalArgumentException("negative rewind "+count);
        }
        cursor -= count;
        if (cursor < end - size || cursor < 0)
        {
            throw new IOException("insufficient room in the pushback buffer");
        }
        length -= count;
        if (length < 0)
        {
            throw new IOException("rewinding past input");
        }
        int ld = 0;
        for (int ii=0;ii<count;ii++)
        {
            if (get((cursor+ii)) == '\n')
            {
                ld++;
            }
        }
        if (ld > 0)
        {
            int l = includeLevel.line;
            includeLevel.line = l - ld;
            int c = 0;
            long start = Math.max(0, end-size);
            for (long ii=cursor;ii>=start;ii--)
            {
                if (get(ii) == '\n')
                {
                    break;
                }
                c++;
            }
            includeLevel.column = c;
        }
        else
        {
            int c = includeLevel.column;
            includeLevel.column = c - count;
        }
    }
772334
public static <E> E last(E[] array) {
        return new LastElement<E>().apply(new ArrayIterator<>(array));
    }
468202
protected void reverse() {
    for(int i = 0, j = size - 1; i < j; i++, j--) {
      double tmpd = dists[j];
      dists[j] = dists[i];
      dists[i] = tmpd;
      int tmpi = ids[j];
      ids[j] = ids[i];
      ids[i] = tmpi;
    }
  }
408804
private List<T> records(int index, List<T> records, boolean reverse){
        this.index = index;
        if(reverse)
            Collections.reverse(records);
        firstRow = records.get(0);
        lastRow = records.get(records.size()-1);
        return records;
    }
1356381
private static void reverseRange(Object[] a, int lo, int hi) {
        hi--;
        while (lo < hi) {
            Object t = a[lo];
            a[lo++] = a[hi];
            a[hi--] = t;
        }
    }
35332
public void reverse() {
		for (int i = 0; i < size / 2; i++) {
			T tmp = data[i];
			data[i] = data[size - i - 1];
			data[size - i - 1] = tmp;
		}
	}
1014984
public static <T> T[] reverseArray(T[] arr) {
		for (int left = 0, right = arr.length - 1; left < right; left++, right--) {
			T temp = arr[left];
			arr[left] = arr[right];
			arr[right] = temp;
		}
		return arr;
	}
1231976
public static List<String> reverse(final String[] array) {
        
        ArgUtils.notNull(array, "array");
        if(array.length == 0) {
            return new ArrayList<String>();
        }
        
        final List<String> list = Arrays.asList(array);
        Collections.sort(list, new Comparator<String>() {
            
            @Override
            public int compare(final String str1, final String str2) {
                
                int len1 = str1.length();
                int len2 = str2.length();
                
                if(len1 != len2) {
                    // 逆順
                    return Integer.compare(len1, len2) * -1;
                } else {
                    // 逆順
                    return str1.compareTo(str2) * 1;
                }
            }
        });
        
        return list;
    }
930830
function last(array) {

  var n,
    getter,
    args,
    reversed;

  if(!isArray(array)) {
    return array;
  }

  //cuz reverse change our src array
  //and we don't want side effects
  reversed = array.slice();

  args = Array.prototype.slice.call(arguments, 1);
  n = (isNumber(args[0])) ? args[0] : 1;
  getter = (!isNumber(args[0]))  ? args[0] : (!isNumber(args[1])) ? args[1] : undefined;

  return (args.length)
    //send reversed array as arguments, and reverse it back as result
    ? getFirstMatches(reversed.reverse(), n,(getter) ? $parse(getter) : getter).reverse()
    //get the last element
    : reversed[reversed.length-1];
}