Java List Create create2DHorizontalIndexList( final int n)

Here you can find the source of create2DHorizontalIndexList( final int n)

Description

create D Horizontal Index List

License

Open Source License

Parameter

Parameter Description
n size of 2d index

Return

a 2D index like { {0,1,2,...,n-1} }

Declaration

public static List<List<Integer>> create2DHorizontalIndexList(
        final int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**//from w ww  .ja  v a  2s . c o m
     * @param n size of 2d index
     * @return a 2D index like { {0,1,2,...,n-1} }
     */
    public static List<List<Integer>> create2DHorizontalIndexList(
            final int n) {
        List<List<Integer>> result = new ArrayList<List<Integer>>();
        result.add(new ArrayList<Integer>());
        for (int i = 0; i < n; i++) {
            result.get(0).add(i);
        }
        return result;
    }
}

Related

  1. asList(T... items)
  2. asList(T... objs)
  3. asList(T[] array)
  4. asListBox(double[] a)
  5. asListNoNulls(T... array)
  6. createActMask(ArrayList stateActions, ArrayList beliefActions)
  7. createAndInitializeList(int size, int begin)
  8. createArgumentList(List args)
  9. createArrayFromUsers(List userList)