Java Collection to Array toFloatArray(final Collection c)

Here you can find the source of toFloatArray(final Collection c)

Description

to Float Array

License

Apache License

Declaration

public static float[] toFloatArray(final Collection<Float> c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static float[] toFloatArray(final Collection<Float> c) {
        if (null == c || c.isEmpty()) {
            return new float[0];
        }/* w ww  .  j ava 2  s  .c  o  m*/
        final float[] list = new float[c.size()];
        int i = 0;
        for (final Number item : c) {
            list[i] = item.floatValue();
            i++;
        }
        return list;
    }
}

Related

  1. toDoubleArray(Collection ds)
  2. toDoubleArray(final Collection doubleColl)
  3. toFloatArray(Collection collection)
  4. toFloatArray(Collection c)
  5. toFloatArray(Collection array)
  6. toIntArray(Collection coll)
  7. toIntArray(Collection coll)
  8. toIntArray(Collection collection)
  9. toIntArray(Collection collection)