Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Collections;
import java.util.List;

public class Main {
    /**
     * Shift object to the top of list
     *
     * @param list  list
     * @param index object index
     */
    public static void shiftItemToFront(List<?> list, int index) {
        if (index >= 0) {
            Collections.rotate(list.subList(index, list.size()), -1);
        }
    }
}