Java List to Primitive Array toPrimitiveIntArray(List temp)

Here you can find the source of toPrimitiveIntArray(List temp)

Description

to Primitive Int Array

License

Apache License

Declaration

private static int[] toPrimitiveIntArray(List temp) 

Method Source Code

//package com.java2s;
/* ====================================================================
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.//from   w w w . j  av  a2  s  .com
 ==================================================================== */

import java.util.List;

public class Main {
    private static int[] toPrimitiveIntArray(List temp) {
        int nItems = temp.size();
        if (nItems < 1) {
            return null;
        }
        Integer[] boxInts = new Integer[nItems];
        temp.toArray(boxInts);

        int[] result = new int[nItems];
        for (int i = 0; i < result.length; i++) {
            result[i] = boxInts[i].intValue();
        }
        return result;
    }
}

Related

  1. toPrimitiveArray(List input)
  2. toPrimitiveArray(List list)
  3. toPrimitiveArray(List target_)
  4. toPrimitivebyList(List list)
  5. toPrimitiveDouble(List values)
  6. toPrimitiveIntArray(List values)
  7. toPrimitiveIntegerArray(List listOfInt)
  8. toPrimitiveLongArray(List items)
  9. toPrimitiveLongArray(List l)