zoukankan      html  css  js  c++  java
  • 判空工具类

    package com.cinc.ecmp.utils;
    
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    
    import org.apache.commons.lang.ArrayUtils;
    import org.apache.commons.lang.StringUtils;
    import org.springframework.util.CollectionUtils;
    
    /**
     * @Author: 
     * @Despriction: 判空类
     * @CreatedTime: 2019/6/5 11:06
     * @ModifyBy:
     * @ModifyTime:
     * @ModifyDespriction:
     * @Version: V1.0.0
     */
    
    public class EmptyUtils {
    	
    	/**
    	 * @param str : { str 为  null ,""," "的情况下都返回true}
    	 * @return boolean
    	 */
    	public static boolean isStringEmpty(String str){
    		return StringUtils.isBlank(str);
    	}
    
    	/**
    	 * @param list { list 为 null  size=0 的情况下返回true}
    	 * @return boolean
    	 */
    	public static boolean isListEmpty(List<?> list){
    		return CollectionUtils.isEmpty(list);
    	}
    	
    	/**
    	 * @param set 为 null  size=0 的情况下返回true
    	 * @return
    	 */
    	public static boolean isSetEmpty(Set<?> set){
    		return CollectionUtils.isEmpty(set);
    	}
    	
    	/**
    	 * @param map{ map.entrySet() 为空的情况下返回true }
    	 * @return boolean
    	 */
    	public static boolean isMapEmpty(Map<?,?> map){
    		return CollectionUtils.isEmpty(map);
    	}
    	
    	/**
    	 * @param_array为空或长度为0的情况下返回true
    	 * @return boolean
    	 */
    	public static boolean isArrayEmpty(Object [] array){
    		return ArrayUtils.isEmpty(array);
    	}
    	
    	/**
    	 * @param_array为空或长度为0的情况下返回true
    	 * @return boolean
    	 */
    	public static boolean isArrayEmpty(int [] array){
    		return ArrayUtils.isEmpty(array);
    	}
    	
    }
    

      

  • 相关阅读:
    mysql联合主键自增、主键最大长度小记
    针对list集合进行分页展示
    初识javascript变量和基本数据类型
    12.19如何定义正则表达式
    人民币符号在html的显示方法
    windows下的NodeJS安装
    css 实现未知图片垂直居中
    IE678下placeholder效果,支持文本框和密码框
    jvm004 解析与分派
    jvm003 类加载的过程
  • 原文地址:https://www.cnblogs.com/HHR-SUN/p/11361879.html
Copyright © 2011-2022 走看看