Java Utililty Methods Array Swap

List of utility methods to do Array Swap

Description

The list of methods to do Array Swap are organized into topic(s).

Method

voidswap(Object aobj[], int i, int j, int k)
swap
for (int l = 0; l < i; l++) {
    Object obj = aobj[j + l];
    aobj[j + l] = aobj[k + l];
    aobj[k + l] = obj;
voidswap(Object[] arr, int a, int b)
Swaps arr[a] with arr[b] in the specified array.
Object tempObj = arr[a];
arr[a] = arr[b];
arr[b] = tempObj;
voidswap(Object[] arr, int i, int j)
Swaps the two specified elements in the specified array.
Object tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
voidswap(Object[] arr, int i, int j)
Swap two elements of an Array.
Object t = arr[i];
arr[i] = arr[j];
arr[j] = t;
voidswap(Object[] array)
Reverse the elements in the array.
int start = 0;
int end = array.length - 1;
while (start < end) {
    Object temp = array[start];
    array[start++] = array[end];
    array[end--] = temp;
voidswap(Object[] array, int a, int b)
swap
Object aux = array[a];
array[a] = array[b];
array[b] = aux;
voidswap(Object[] x, int a, int b)
Swaps x[a] with x[b].
Object t = x[a];
x[a] = x[b];
x[b] = t;
voidswap(short x[], int a, int b)
Swaps x[a] with x[b].
short t = x[a];
x[a] = x[b];
x[b] = t;
voidswap(short x[], int[] y, int a, int b)
Swaps x[a] with x[b].
short t = x[a];
x[a] = x[b];
x[b] = t;
int o = y[a];
y[a] = y[b];
y[b] = o;
voidswap(short x[], T[] a2, int a, int b)
Swaps x[a] with x[b].
short t = x[a];
x[a] = x[b];
x[b] = t;
T t2 = a2[a];
a2[a] = a2[b];
a2[b] = t2;