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 String[] toStringArray(Object[] objs) {
        if (objs == null)
            return new String[] {};
        String[] strs = new String[objs.length];
        for (int i = 0; i < objs.length; i++) {
            strs[i] = String.valueOf(objs[i]);
        }
        return strs;
    }

    public static String[] toStringArray(List<String> list) {
        if (isEmpty(list)) {
            return new String[] {};
        }
        int size = list.size();
        String[] strs = list.toArray(new String[size]);
        return strs;
    }

    public static boolean isEmpty(List<?> list) {
        if (list == null)
            return true;
        return list.isEmpty();
    }
}