Here you can find the source of move(List aList, int anIndex1, int anIndex2)
public static void move(List aList, int anIndex1, int anIndex2)
//package com.java2s; import java.util.*; public class Main { /**//from w ww .j a v a2 s . c om * Moves the object at index 1 to index 2. */ public static void move(List aList, int anIndex1, int anIndex2) { // If either index is invalid, return if (anIndex1 < 0 || anIndex1 >= aList.size() || anIndex2 < 0 || anIndex2 >= aList.size()) return; // Remove object and re-insert and desired index Object obj = aList.remove(anIndex1); aList.add(anIndex2, obj); } /** * Returns the size of a list (accepts null list). */ public static int size(List aList) { return aList == null ? 0 : aList.size(); } /** * Removes given object from given list (accepts null list). */ public static boolean remove(List aList, Object anObj) { return aList == null ? false : aList.remove(anObj); } /** * Removes range of objects from given list (from start to end, not including end). */ public static void remove(List aList, int start, int end) { for (int i = end - 1; i >= start; i--) aList.remove(i); } /** * Adds an object to the given list and returns list (creates list if missing). */ public static <T> List<T> add(List<T> aList, T anObj) { // If list is null, create list if (aList == null) aList = new Vector(); // Add object aList.add(anObj); // Return list return aList; } }