Java List Create createAndInitializeList(int size, int begin)

Here you can find the source of createAndInitializeList(int size, int begin)

Description

Creates a mutable list containing size incrementing integer values beginning with begin.

License

Open Source License

Parameter

Parameter Description
size Number of integer values within the result list
begin First integer to start with

Return

A list containing incrementing integer values beginning with the specified value

Declaration

public static List<Integer> createAndInitializeList(int size, int begin) 

Method Source Code

//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;
    }
}

Related

  1. asList(T[] array)
  2. asListBox(double[] a)
  3. asListNoNulls(T... array)
  4. create2DHorizontalIndexList( final int n)
  5. createActMask(ArrayList stateActions, ArrayList beliefActions)
  6. createArgumentList(List args)
  7. createArrayFromUsers(List userList)
  8. createArrayList()
  9. createBarrier(List text)