Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    /**
     * Sub the list without exception
     */
    public static <T> List<T> safeSubList(List<T> list, int start, int end) {
        if (start >= list.size()) {
            return Collections.emptyList();
        }
        return list.subList(start, Math.min(end, list.size()));
    }
}