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 {
    public static <T> List<T> getPart(List<T> list, T start, T finish) {
        int startIndex = list.indexOf(start);
        if (startIndex < 0)
            return Collections.<T>emptyList();

        List<T> subList = list.subList(startIndex + 1, list.size());
        int endIndex = subList.indexOf(finish);
        return endIndex <= 0 ? Collections.<T>emptyList() : subList.subList(0, endIndex);
    }
}