Java List to Int List toInts(List list)

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

Description

to Ints

License

BSD License

Declaration

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

Method Source Code

//package com.java2s;
/*L//from   w w w  .  j a  v  a  2s .  c  o  m
 * Copyright Northrop Grumman Information Technology.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/nci-value-set-editor/LICENSE.txt for details.
 */

import java.util.*;

public class Main {
    public static int[] toInts(List<Integer> list) {
        int[] values = new int[list.size()];
        int i = 0;

        Iterator<Integer> iterator = list.iterator();
        while (iterator.hasNext()) {
            Integer value = iterator.next();
            values[i++] = value;
        }
        return values;
    }
}

Related

  1. toIntegers(final List longs)
  2. toIntegers(List values)
  3. toIntList(List list)
  4. toIntList(Set members)
  5. toIntList(String arr, String separator)