Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;
import java.util.List;

public class Main {
    public static List getSubList(List list, int fromIndex, int toIndex) {
        if (fromIndex > toIndex) {
            return null;
        }

        int size = size(list);

        if (fromIndex < 0 || toIndex > size) {
            return null;
        }

        return list.subList(fromIndex, toIndex);
    }

    public final static int size(Collection c) {
        return c == null ? 0 : c.size();
    }
}