Here you can find the source of move(List> collection, int indexToMoveFrom, int indexToMoveAt)
public static void move(List<?> collection, int indexToMoveFrom, int indexToMoveAt)
//package com.java2s; //License from project: LGPL import java.util.Collections; import java.util.List; public class Main { public static void move(List<?> collection, int indexToMoveFrom, int indexToMoveAt) { if (indexToMoveAt >= indexToMoveFrom) { Collections.rotate(collection.subList(indexToMoveFrom, indexToMoveAt + 1), -1); } else {/*from w ww . j ava 2 s. c om*/ Collections.rotate(collection.subList(indexToMoveAt, indexToMoveFrom + 1), 1); } } }