Here you can find the source of moveUpInList(List
public static <E> boolean moveUpInList(List<E> list, int... indices)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.List; public class Main { public static <E> boolean moveUpInList(List<E> list, int... indices) { // ignore calls which contain first index if (isInArray(indices, 0)) { return false; }// www .java2s .c o m Arrays.sort(indices); boolean changed = false; for (int i : indices) { changed |= moveUpInListSingleEntry(list, i); } return changed; } public static boolean isInArray(int[] array, int element) { for (int i : array) { if (i == element) { return true; } } return false; } private static <E> boolean moveUpInListSingleEntry(List<E> list, int index) { // ignore calls which try to move up first index if (index == 0) { return false; } E element = list.remove(index); list.add(index - 1, element); return true; } }