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(int arrs[], int i, int j)
Swap method, It is used to intechange values into an array.
int temp = arrs[i];
arrs[i] = arrs[j];
arrs[j] = temp;
voidswap(int i, int j, Integer[] unsorted)
swap
Integer t = unsorted[i];
unsorted[i] = unsorted[j];
unsorted[j] = t;
voidswap(int i, int j, String[] index)
Method swap.
String tmp = index[i];
index[i] = index[j];
index[j] = tmp;
voidswap(int keys[], int values[], int a, int b)
swap
int tmp = keys[a];
keys[a] = keys[b];
keys[b] = tmp;
tmp = values[a];
values[a] = values[b];
values[b] = tmp;
voidswap(int[] a, int first, int second)
swap
if (first == second) {
    return;
int temp = a[first];
a[first] = a[second];
a[second] = temp;
voidswap(int[] a, int i, int j)
Swap ith element in a with jth element.
int temp = a[i];
a[i] = a[j];
a[j] = temp;
voidswap(int[] arr, int a, int b)
Swaps two elements of an array.
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
voidswap(int[] arr, int a, int b)
swap
int t = arr[a];
arr[a] = arr[b];
arr[b] = t;
voidswap(int[] arr, int a, int b, int c, int d, int key)
swap
int temp;
switch (key) {
case 0:
    temp = arr[d];
    arr[d] = arr[c];
    arr[c] = arr[b];
    arr[b] = arr[a];
    arr[a] = temp;
...
voidswap(int[] arr, int i, int j)
swap
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;