Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.*;

public class Main {
    public static String stringify(Object[] array) {
        if (isEmpty(array)) {
            return "";
        } else {
            StringBuilder sb = new StringBuilder("{ ");
            for (Object obj : array)
                sb.append(obj).append(", ");
            return sb.deleteCharAt(sb.length() - 2).append("}").toString();
        }
    }

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

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