is List Empty - Java java.util

Java examples for java.util:List Operation

Description

is List Empty

Demo Code


//package com.java2s;

import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] argv) {
        List list = java.util.Arrays.asList("asdf", "java2s.com");
        System.out.println(isEmpty(list));
    }//from  www . j  a v a 2s  .  c  o m

    public static <T> boolean isEmpty(List<T> list) {
        return list == null || list.isEmpty();
    }

    public static <K, V> boolean isEmpty(Map<K, V> map) {
        return map == null || map.isEmpty();
    }
}

Related Tutorials