Android examples for java.lang:array convert
Convert List<Long> to long Array as long[]
import android.util.SparseArray; import java.util.ArrayList; import java.util.List; public class Main{ public static long[] toLongArray(List<Long> list) { if (list == null || list.isEmpty()) return null; long[] arr = new long[list.size()]; for (int i = 0; i < list.size(); i++) { arr[i] = list.get(i).longValue(); }/*www . j a v a 2 s . c om*/ return arr; } }