Java Array Swap swap(Comparable[] a, int oldIndex, int newIndex)

Here you can find the source of swap(Comparable[] a, int oldIndex, int newIndex)

Description

swap

License

Open Source License

Declaration

public static void swap(Comparable[] a, int oldIndex, int newIndex) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void swap(Comparable[] a, int oldIndex, int newIndex) {
        Comparable t = a[oldIndex];
        a[oldIndex] = a[newIndex];/*  www  . j  a  v  a 2s.c  o  m*/
        a[newIndex] = t;
    }
}

Related

  1. swap(byte[] buffer, int i, int j)
  2. swap(byte[] bytes)
  3. swap(byte[] data)
  4. swap(byte[] data, int p, int q)
  5. swap(byte[] rv, int offsetA, int offsetB)
  6. swap(double x[], Object[] corr, int a, int b)
  7. swap(double[] a, int i, int j)
  8. swap(double[] array, int i, int j)
  9. swap(double[] data, int i, int j)