Java Array Swap swap(T[] array, int first_idx, int last_idx)

Here you can find the source of swap(T[] array, int first_idx, int last_idx)

Description

swap

License

Open Source License

Declaration

public static <T> void swap(T[] array, int first_idx, int last_idx) 

Method Source Code

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

public class Main {
    public static <T> void swap(T[] array, int first_idx, int last_idx) {
        T tmp = array[first_idx];//from www . j  a v  a2  s. c  om
        array[first_idx] = array[last_idx];
        array[last_idx] = tmp;
    }
}

Related

  1. swap(T[] arr, int a, int b)
  2. swap(T[] arr, int i, int j)
  3. swap(T[] arr, int index1, int index2)
  4. swap(T[] arr, int pos1, int pos2)
  5. swap(T[] array, int a, int b)
  6. swap(T[] array, int i, int len)
  7. swap(T[] array, int indexOne, int indexTwo)
  8. swap(T[] data, int a, int b)
  9. swap(T[] elements, int i, int j)