Java List to Array toArray(List list)

Here you can find the source of toArray(List list)

Description

Converts a list of integers to an array

License

LGPL

Parameter

Parameter Description
list the list of integers

Return

the converted array of integers

Declaration

public static int[] toArray(List<Integer> list) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.List;

public class Main {
    /**//from ww w.j  ava2s.  c  o  m
     * Converts a list of integers to an array
     * 
     * @param list
     *            the list of integers
     * @return the converted array of integers
     */
    public static int[] toArray(List<Integer> list) {
        int[] array = new int[list.size()];
        for (int i = 0, l = list.size(); i < l; i++)
            array[i] = list.get(i);
        return array;
    }
}

Related

  1. toArray(List enums)
  2. toArray(List from, int[] to)
  3. toArray(List l)
  4. toArray(List list)
  5. toArray(List list)
  6. toLongList(String str, String splitStr)
  7. toLongList(String[] array)
  8. toObjectArray(List> lists)
  9. toObjectArray(List list)

    HOME | Copyright © www.java2s.com 2016