Java List to Long Number Array toLongArray(List list)

Here you can find the source of toLongArray(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 long[] toLongArray(List<Long> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**//from   www.java 2  s. com
     * This converts a list to it's primitive state.
     * In this case, it converts a {@link Long} list to a
     * long array.
     * 
     * @param list The list to convert
     * @return The primitive array instance of the list's contents.
     */
    public static long[] toLongArray(List<Long> list) {
        long[] array = new long[list.size()];
        for (int i = 0; i < list.size(); i++) {
            array[i] = list.get(i);
        }
        return array;
    }

    public static long[] toLongArray(long... arr) {
        return arr;
    }
}

Related

  1. toLongArray(final List idList)
  2. toLongArray(List list)
  3. toLongArray(List list)
  4. toLongArray(List list)
  5. toLongArray(List list)
  6. toLongArray(List values)
  7. toLongList(List members)
  8. toLongList(List stringList)
  9. toLongList(Set set)