Here you can find the source of asList(float[] elements)
Parameter | Description |
---|---|
elements | Array of float numbers. |
public static List<Float> asList(float[] elements)
//package com.java2s; /*/*from w ww .ja v a 2s .c o m*/ * VectorGraphics2D: Vector export for Java(R) Graphics2D * * (C) Copyright 2010-2016 Erich Seifert <dev[at]erichseifert.de> * * This file is part of VectorGraphics2D. * * VectorGraphics2D is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VectorGraphics2D 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>. */ import java.util.ArrayList; import java.util.List; public class Main { /** * Converts an array of {@code float} numbers to a list of {@code Float}s. * The list will be empty if the array is empty or {@code null}. * @param elements Array of float numbers. * @return A list with all numbers as {@code Float}. */ public static List<Float> asList(float[] elements) { int size = (elements != null) ? elements.length : 0; List<Float> list = new ArrayList<Float>(size); if (elements != null) { for (Float elem : elements) { list.add(elem); } } return list; } /** * Converts an array of {@code double} numbers to a list of {@code Double}s. * The list will be empty if the array is empty or {@code null}. * @param elements Array of double numbers. * @return A list with all numbers as {@code Double}. */ public static List<Double> asList(double[] elements) { int size = (elements != null) ? elements.length : 0; List<Double> list = new ArrayList<Double>(size); if (elements != null) { for (Double elem : elements) { list.add(elem); } } return list; } }