Move the given item to specified index in list - Java Quiz Question


Write a program to move the given item to specified index in a list.

Input (String to move, increment, String List) Output List(After Move)
Virat Kohli
-7
[Sachin Tendulkar, Sehwag, Yuvraj Singh, Dhoni, Gautam Gambhir, Suresh Raina, Rohit Sharma, Virat Kohli]
[Virat Kohli, Sehwag, Yuvraj Singh, Dhoni, Gautam Gambhir, Suresh Raina, Rohit Sharma, Sachin Tendulkar]
Virat Kohli
-11
[Sachin Tendulkar, Sehwag, Yuvraj Singh, Dhoni, Gautam Gambhir, Suresh Raina, Rohit Sharma, Virat Kohli]
[Sachin Tendulkar, Sehwag, Yuvraj Singh, Dhoni, Gautam Gambhir, Suresh Raina, Rohit Sharma, Virat Kohli]
MEC
2
[MEC, EEE, CIVIL, ECE, CSE, IT]
[CIVIL, EEE, MEC, ECE, CSE, IT]
MEC
2
[]
[]
""
2
[MEC, EEE, CIVIL, ECE, CSE, IT]
[MEC, EEE, CIVIL, ECE, CSE, IT]
null
2
[MEC, EEE, CIVIL, ECE, CSE, IT]
[MEC, EEE, CIVIL, ECE, CSE, IT]


import java.util.*;
class MoveItemToSpecifiedIncrement
{
    public static void main(String s[])
    {
        ArrayList<String> list = new ArrayList<String>();
        list.add("Sachin Tendulkar");
        list.add("Sehwag");
        list.add("Yuvraj Singh");
        list.add("Dhoni");
        list.add("Gautam Gambhir");
        list.add("Suresh Raina");
        list.add("Rohit Sharma");
        list.add("Virat Kohli");
        String itemToMove = "Virat Kohli";
        move(itemToMove, -7, list);
        System.out.println("The elements in list after the move "+list);

    }


        public static void move(String itemToMove, int increment, List<String> list)
        {
        }

}