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);
    	}
    	
    }
    

      

  • 相关阅读:
    解析库之 beautifulsoup模块
    请求库之 selenium模块
    请求库之 requests模块
    一句话
    JPA学习03
    JPA学习02
    JPA学习01
    SpringData学习04
    SpringData学习03
    SpringData学习02
  • 原文地址:https://www.cnblogs.com/HHR-SUN/p/11361879.html
Copyright © 2011-2022 走看看