Java List to Int List toIntArray(List intList)

Here you can find the source of toIntArray(List intList)

Description

Convert a List into the primitive type array

License

Open Source License

Parameter

Parameter Description
intList the List<Integer> to convert to

Return

a converted array of int primitive type

Declaration

public static int[] toIntArray(List<Integer> intList) 

Method Source Code

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

import java.util.List;

public class Main {
    /**/*from   w  w w.  j a  va  2  s. com*/
     * Convert a List<Integer> into the primitive type array
     * 
     * @param intList the List<Integer> to convert to
     * @return a converted array of int primitive type
     */
    public static int[] toIntArray(List<Integer> intList) {
        assert intList != null;
        if (intList == null) {
            return null;
        }

        int[] ints = new int[intList.size()];
        for (int i = 0; i < intList.size(); i++) {
            ints[i] = intList.get(i);
        }

        return ints;
    }
}

Related

  1. toIntArray(List nums)
  2. toIntArray(List ints)
  3. toIntArray(List bytes)
  4. toIntArray(List a)
  5. toIntArray(List integerList)
  6. toIntArray(List list)
  7. toIntArray(List list)
  8. toIntArray(List list)
  9. toIntArray(List list)