01: package snow.utils;
02:
03: import java.util.*;
04:
05: public final class ArrayUtils {
06: private ArrayUtils() {
07: }
08:
09: public static int[] toIntArray(List<Integer> v) {
10: int[] a = new int[v.size()];
11: for (int i = 0; i < a.length; i++) {
12: a[i] = v.get(i);
13: }
14: return a;
15: }
16:
17: public static boolean contains(int[] v, int a) {
18: for (int i = 0; i < v.length; i++) {
19: if (v[i] == a)
20: return true;
21: }
22: return false;
23: }
24:
25: public static <T> boolean isEmpty(T[] a) {
26: if (a == null)
27: return true;
28: if (a.length == 0)
29: return true;
30: return false;
31: }
32:
33: }
|