Java List to Primitive Array toPrimitiveIntegerArray(List listOfInt)

Here you can find the source of toPrimitiveIntegerArray(List listOfInt)

Description

to Primitive Integer Array

License

Open Source License

Declaration

public static int[] toPrimitiveIntegerArray(List<Integer> listOfInt) 

Method Source Code

//package com.java2s;
/*//from   w w  w.  j  a v a  2 s.  c o m
 * Copyright (c) 2012, 2013 Mateusz Parzonka
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Mateusz Parzonka - initial API and implementation
 */

import java.util.List;

public class Main {
    public static int[] toPrimitiveIntegerArray(List<Integer> listOfInt) {
        int[] result = new int[listOfInt.size()];
        int i = 0;
        for (Integer n : listOfInt) {
            result[i++] = n;
        }
        return result;
    }
}

Related

  1. toPrimitiveArray(List target_)
  2. toPrimitivebyList(List list)
  3. toPrimitiveDouble(List values)
  4. toPrimitiveIntArray(List temp)
  5. toPrimitiveIntArray(List values)
  6. toPrimitiveLongArray(List items)
  7. toPrimitiveLongArray(List l)
  8. ToPrimitiveLongArray(List list)
  9. toPrimitives(List oInt)