Java List to Float Array toFloatArray(List list)

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

Description

to Float Array

License

Open Source License

Declaration

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

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static float[] toFloatArray(List<Float> list) {
        if (isNullOrEmpty(list)) {
            return null;
        }/*from   ww  w. j a  v  a2 s  .  c o m*/
        float[] floats = new float[list.size()];
        for (int i = 0; i < floats.length; i++) {
            floats[i] = list.get(i);
        }
        return floats;
    }

    public static boolean isNullOrEmpty(Collection c) {
        return c == null || c.isEmpty();
    }

    public static boolean isNullOrEmpty(String s) {
        return s == null || s.isEmpty();
    }
}

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)