Java List to Int List toIntArray(List list)

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

Description

to Int Array

License

Open Source License

Declaration

public static int[] toIntArray(List<Integer> list) 

Method Source Code


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

import java.util.*;

public class Main {
    public static int[] toIntArray(List<Integer> list) {
        if (isNullOrEmpty(list)) {
            return null;
        }/*from   ww  w.  j  a  va  2s  .  c o m*/
        int[] ints = new int[list.size()];
        for (int i = 0; i < ints.length; i++) {
            ints[i] = list.get(i);
        }
        return ints;
    }

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

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

Related

  1. toIntArray(List list)
  2. toIntArray(List list)
  3. toIntArray(List list)
  4. toIntArray(List list)
  5. toIntArray(List list)
  6. toIntArray(List list)
  7. toIntArray(List list)
  8. toIntArray(List list)
  9. toIntArray(List values)