Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> limit(List<T> source, int size) { return new ArrayList<>(source.subList(0, size)); } }