Delete item in list from position index From and insert it to index Two - Android java.util

Android examples for java.util:List Element

Description

Delete item in list from position index From and insert it to index Two

Demo Code


//package com.java2s;

import java.util.List;

public class Main {
    /**//  w w  w  . ja v a  2s  .c o m
     * Delete item in <code>list</code> from position <code>indexFrom</code> and insert it to <code>indexTwo</code>
     *
     * @param list
     * @param indexFrom
     * @param indexTwo
     */
    public static void reorder(List list, int indexFrom, int indexTwo) {
        Object obj = list.remove(indexFrom);
        list.add(indexTwo, obj);
    }
}

Related Tutorials