Here you can find the source of moveDownItems(List
public static <T> void moveDownItems(List<T> list, int[] positions)
//package com.java2s; /**/* www . j av a2 s. c o m*/ * Copyright 2008 Autentia Real Business Solutions S.L. This file is part of autentia-util. autentia-util is free software: * you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation, version 3 of the License. autentia-util is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public * License along with autentia-util. If not, see <http://www.gnu.org/licenses/>. */ import java.util.List; public class Main { public static <T> void moveDownItems(List<T> list, int[] positions) { for (int i = positions.length - 1; i >= 0; i--) { moveDownItem(list, positions[i]); } } public static <T> void moveDownItem(List<T> list, int position) { if (position < list.size() - 1) { final T aux = list.get(position + 1); list.set(position + 1, list.get(position)); list.set(position, aux); } } }