Here you can find the source of createIntListToN(int n)
Parameter | Description |
---|---|
n | size of the ArrayList (n-1 is the last value) |
public static ArrayList<Integer> createIntListToN(int n)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { /**/* w w w . ja v a 2 s . co m*/ * createIntListToN: creates an ArrayList of n integers from 0 to n-1 * useful to create a list for considering all the values of the rows or columns of the alignment matrix * Takes O(n) * @param n size of the ArrayList (n-1 is the last value) * @return arrayList of integer values from 0 to n-1 * @author michele */ public static ArrayList<Integer> createIntListToN(int n) { ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < n; i++) { list.add(i); } return list; } }