js与java判断字符串与数组是否为空

判断字符串是否为空

 $.isEmptyStr = function(str){
        if(null != str && '' != str && 'undefined' != str)
        	return false;
        return true;
    };

判断数组是否为空

   $.isEmptyArray = function(list){
    	if(list && list instanceof Array && list.length > 0)
    		return false;
    	return true;
    };

java判断字符串是否为空

 public static boolean isEmpty(Object str)
  {
    return (str == null) || ("".equals(str));
  }

java判断集合是否为空

import java.util.Map;
import java.util.Collection;

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

猜你喜欢

转载自blog.csdn.net/qq_35029061/article/details/82515678