Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;
import java.util.Collection;

import java.util.List;

public class Main {

    public static <T> List<T> subCollection(Collection<T> collection, int start, int end) {
        if (null == collection || collection.isEmpty())
            return null;
        int count = 0;
        List<T> result = new ArrayList<T>();
        for (T item : collection) {
            if (start >= count && count < end) {
                result.add(item);
            }
            count++;
        }
        return result;
    }
}