Java List to Array toArray(List list)

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

Description

to Array

License

MIT License

Parameter

Parameter Description
list a parameter

Declaration

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

Method Source Code

//package com.java2s;
/*// w  ww  .ja  va  2  s . co  m
 * Wegas
 * http://wegas.albasim.ch
 *
 * Copyright (c) 2013 School of Business and Engineering Vaud, Comem
 * Licensed under the MIT License
 */

import java.util.List;

public class Main {
    /**
     *
     * @param list
     * @return
     */
    public static int[] toArray(List<Integer> list) {
        int[] ret = new int[list.size()];
        int i = 0;
        for (Integer e : list) {
            ret[i++] = e.intValue();
        }
        return ret;
    }
}

Related

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