Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <A> List<A> take(List<A> list, int n) {
        List<A> result = new ArrayList<A>();
        for (int j = 0; j < Math.min(n, list.size()); ++j)
            result.add(list.get(j));
        return result;
    }
}