Java List Copy copyToArray(List list, float[] array)

Here you can find the source of copyToArray(List list, float[] array)

Description

Copies the contents from an array list to an array.

License

Open Source License

Parameter

Parameter Description
list The array list to copy from.
array The array to copy to (keep same size as list).

Return

The copied array.

Declaration

public static float[] copyToArray(List<Float> list, float[] array) 

Method Source Code


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

import java.util.*;

public class Main {
    /**/* www  .j  av a 2s . c o m*/
     * Copies the contents from an array list to an array.
     *
     * @param list The array list to copy from.
     * @param array The array to copy to (keep same size as list).
     *
     * @return The copied array.
     */
    public static float[] copyToArray(List<Float> list, float[] array) {
        for (int i = 0; i < list.size(); i++) {
            array[i] = list.get(i);
        }

        return array;
    }
}

Related

  1. copyProbabilities(List targetProbs, List destinationProbs)
  2. copyQueryFilters(List queryFilters)
  3. copySafelyToObjectList(java.util.List list)
  4. copyStringList(List l1)
  5. copyStringList(List list)
  6. copyToArrayListWithExtraCapacity(T[] elements, int extraCapacity)
  7. copyToList(Iterable elements)
  8. copyTypes(List src, List dest)