Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static final char[] EMPTY_CHAR_ARRAY = new char[0];

    public static char[] toPrimitiveChar(final List<Integer> array) {
        if (array == null) {
            return null;
        }
        if (array.isEmpty()) {
            return EMPTY_CHAR_ARRAY;
        }
        final char[] result = new char[array.size()];
        for (int i = 0; i < array.size(); i++) {
            result[i] = (char) array.get(i).byteValue();
        }
        return result;
    }

    public static boolean isEmpty(final boolean[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final byte[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final int[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final long[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final float[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final double[] array) {
        return array == null || array.length == 0;
    }

    public static <T> boolean isEmpty(final T[] array) {
        return array == null || array.length == 0;
    }
}