Convert List of Long to long[] array - Java java.util

Java examples for java.util:List Convert

Description

Convert List of Long to long[] array

Demo Code


//package com.java2s;

import java.util.Iterator;

import java.util.List;

public class Main {
    public static final long[] listLong2longarray(List<Long> list) {
        final long[] dst = new long[list.size()];
        int i = 0;
        for (Iterator<Long> iter = list.iterator(); iter.hasNext();) {
            dst[i++] = (iter.next()).longValue();
        }/*from   www  .  j a  v  a2s .c o  m*/
        return dst;
    }
}

Related Tutorials