Java List to Array listToArray(List doubles)

Here you can find the source of listToArray(List doubles)

Description

Convert a list of Doubles to an array of primitive double types.

License

Open Source License

Parameter

Parameter Description
doubles a list of Doubles

Return

an array of doubles of the length of the input list

Declaration

public static double[] listToArray(List<Double> doubles) 

Method Source Code

//package com.java2s;
/**//  w  ww .  j a v a 2 s .  c  om
 * This file is part of SemEvalCortical.
 * <p>
 * Foobar is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <p>
 * Foobar is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with SemEvalCortical.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.List;

public class Main {
    /**
     * Convert a list of Doubles to an array of primitive double types.
     *
     * @param doubles a list of Doubles
     * @return an array of doubles of the length of the input list
     */
    public static double[] listToArray(List<Double> doubles) {
        double[] array = new double[doubles.size()];
        for (int i = 0; i < doubles.size(); i++) {
            array[i] = doubles.get(i);
        }
        return array;
    }
}

Related

  1. listToArray(List list)
  2. listToArray(List list)
  3. listToArray(List list)
  4. listToArray(List bytes)
  5. listToArray(List list)
  6. listToArray(List list)
  7. listToArray(List list)
  8. ListToArray(List list)
  9. listToArray(List list)