Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//Licensed under the Apache License, Version 2.0 (the "License");

import java.util.Collection;

import java.util.Map;

public class Main {
    public static <T> boolean isEmpty(final Collection<T> collection) {
        return size(collection) == 0;
    }

    public static <K, V> boolean isEmpty(final Map<K, V> map) {
        return size(map) == 0;
    }

    public static int size(final byte[] collection) {
        return collection == null ? 0 : collection.length;
    }

    public static <T> int size(final Collection<T> collection) {
        return collection == null ? 0 : collection.size();
    }

    public static <K, V> int size(final Map<K, V> map) {
        return map == null ? 0 : map.size();
    }
}