Java List to Long Number Array toLongArray(List list)

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

Description

to Long Array

License

Open Source License

Declaration

public static long[] toLongArray(List<Long> list) 

Method Source Code


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

import java.util.*;

public class Main {
    public static long[] toLongArray(List<Long> list) {
        if (isNullOrEmpty(list)) {
            return null;
        }//from  w  w  w .ja  v a 2 s . com
        long[] longs = new long[list.size()];
        for (int i = 0; i < longs.length; i++) {
            longs[i] = list.get(i);
        }
        return longs;
    }

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

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

Related

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