Here you can find the source of createAndInitializeList(int size, int begin)
size
incrementing integer values beginning with begin
.
Parameter | Description |
---|---|
size | Number of integer values within the result list |
begin | First integer to start with |
public static List<Integer> createAndInitializeList(int size, int begin)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**/* w w w . j av a2s . c o m*/ * Creates a mutable list containing <code>size</code> incrementing integer * values beginning with <code>begin</code>. * * @param size * Number of integer values within the result list * @param begin * First integer to start with * @return A list containing incrementing integer values beginning with the * specified value */ public static List<Integer> createAndInitializeList(int size, int begin) { List<Integer> result = new ArrayList<>(size); for (int i = begin; i < size + begin; i++) result.add(i); return result; } }