Java List to Float Array toFloatArray(List list)

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

Description

This converts a list to it's primitive state.

License

Open Source License

Parameter

Parameter Description
list The list to convert

Return

The primitive array instance of the list's contents.

Declaration

public static float[] toFloatArray(List<Float> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**/*from   w  w w . j a  v a 2 s  . c o m*/
     * This converts a list to it's primitive state.
     * In this case, it converts a {@link Float} list to a
     * float array.
     * 
     * @param list The list to convert
     * @return The primitive array instance of the list's contents.
     */
    public static float[] toFloatArray(List<Float> list) {
        float[] array = new float[list.size()];
        for (int i = 0; i < list.size(); i++) {
            array[i] = list.get(i);
        }
        return array;
    }

    /**
     * 
     * @param arr
     * @return
     */
    public static float[] toFloatArray(float... arr) {
        return arr;
    }
}

Related

  1. toFloatArray(Float[] list)
  2. toFloatArray(java.util.List list, float[] res)
  3. toFloatArray(List list)
  4. toFloatArray(List list)
  5. toFloatArray(List list)
  6. toFloatArray(List list)
  7. toFloatArray(List values)
  8. toFloatList(List list)