Java List Create createIntListToN(int n)

Here you can find the source of createIntListToN(int n)

Description

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)

License

Open Source License

Parameter

Parameter Description
n size of the ArrayList (n-1 is the last value)

Return

arrayList of integer values from 0 to n-1

Declaration

public static ArrayList<Integer> createIntListToN(int n) 

Method Source Code

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

Related

  1. createIntegerList(int[] array)
  2. createIntegerQueryString(List values)
  3. CreateIntegerSequenceList(int startNumber, int endNumber)
  4. createIntegerSetFromIntegerList(List integerList)
  5. createInterfaceContent(String typeName, @SuppressWarnings("rawtypes") List superInterfaces, String indentation, String lineSeparator)
  6. createKeyValPair(List lst)
  7. createLimitSql(StringBuilder sql, Integer startNum, Integer rowNum, List params)
  8. createList( Iterator iterator )
  9. createList()

  10. HOME | Copyright © www.java2s.com 2016