Java Collection Empty isEmpty(Collection c)

Here you can find the source of isEmpty(Collection c)

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(Collection<?> c) 

Method Source Code


//package com.java2s;

import java.util.Collection;

public class Main {

    public static boolean isEmpty(Object obj) {
        if (obj == null)
            return true;

        if (obj instanceof String)
            return isEmpty((String) obj);

        if (obj instanceof Collection)
            return isEmpty((Collection<?>) obj);

        return false;
    }// w w  w . j av  a  2  s  .c o m

    public static boolean isEmpty(String s) {
        return ((s == null) || (s.trim().length() == 0));
    }

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

Related

  1. isEmpty(Collection list)
  2. isEmpty(Collection v)
  3. isEmpty(Collection col)
  4. isEmpty(Collection c)
  5. isEmpty(Collection c)
  6. isEmpty(Collection col)
  7. isEmpty(Collection col)
  8. isEmpty(Collection collection)
  9. isEmpty(Collection collection)