Java Array Swap swap(Object[] x, int a, int b)

Here you can find the source of swap(Object[] x, int a, int b)

Description

Swaps x[a] with x[b].

License

Open Source License

Declaration

private static void swap(Object[] x, int a, int b) 

Method Source Code

//package com.java2s;
/*// w  w  w. j  a va  2s.  c  o m
   Leola Programming Language
   Author: Tony Sparks
   See license.txt
*/

public class Main {
    /**
     * Swaps x[a] with x[b].
     */
    private static void swap(Object[] x, int a, int b) {
        Object t = x[a];
        x[a] = x[b];
        x[b] = t;
    }
}

Related

  1. swap(Object[] arr, int a, int b)
  2. swap(Object[] arr, int i, int j)
  3. swap(Object[] arr, int i, int j)
  4. swap(Object[] array)
  5. swap(Object[] array, int a, int b)
  6. swap(short x[], int a, int b)
  7. swap(short x[], int[] y, int a, int b)
  8. swap(short x[], T[] a2, int a, int b)
  9. swap(short[] array, int indexA, int indexB)