Java examples for java.util:Collection Creation
Create a sequence of Int and return a Collection
//package com.java2s; import java.util.Arrays; import java.util.Collection; public class Main { public static void main(String[] argv) { int from = 42; int count = 42; System.out.println(sequence(from, count)); }//from ww w .j a v a2 s. c o m public static Collection<Integer> sequence(final int from, final int count) { final Integer[] arr = new Integer[count]; for (int i = 0; i < count; i++) { arr[i] = Integer.valueOf(from + i); } return Arrays.asList(arr); } }