Java Collection Empty isNotEmpty(Collection c)

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

Description

is Not Empty

License

Open Source License

Declaration

public static boolean isNotEmpty(Collection<?> c) 

Method Source Code


//package com.java2s;

import java.util.Collection;

public class Main {

    public static boolean isNotEmpty(String s) {
        return ((s != null) && (s.trim().length() > 0));
    }/*from  w w w  .  j a  v a 2s  .  c o m*/

    public static boolean isNotEmpty(Collection<?> c) {
        return ((c != null) && (c.size() > 0));
    }

    public static boolean isNotEmpty(Object obj) {
        if (obj == null)
            return false;

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

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

        return true;
    }
}

Related

  1. isNotEmpty(Collection collection)
  2. isNotEmpty(Collection collection)
  3. isNotEmpty(Collection collection)
  4. isNotEmpty(Collection list)
  5. isNotEmpty(Collection c)
  6. isNotEmpty(Collection c)
  7. isNotEmpty(Collection col)
  8. isNotEmpty(Collection colecao)
  9. isNotEmpty(Collection coll)