Java List to Int List toIntArray(List list)

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

Description

Converts a List with Integer objects to a primary type int array

License

Open Source License

Declaration

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

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  .  co  m*/
     * Converts a List with Integer objects to a primary type int array
     */
    public static int[] toIntArray(List<Integer> list) {
        if (list == null)
            return null;
        int[] arr = new int[list.size()];
        int i = 0;
        for (Integer v : list)
            arr[i++] = v;
        return arr;
    }
}

Related

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