package com.jyc.common.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.jyc.common.core.text.StrFormatter;

/**
* 字符串工具类
*
* @author jianyongchao
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils
{
/** 空字符串 */
private static final String NULLSTR = "";

/** 下划线 */
private static final char SEPARATOR = '_';

/**
* 获取参数不为空值
*
* @param value defaultValue 要判断的value
* @return value 返回值
*/
public static <T> T nvl(T value, T defaultValue)
{
return value != null ? value : defaultValue;
}

/**
* * 判断一个Collection是否为空, 包含ListSetQueue
*
* @param coll 要判断的Collection
* @return true:为空 false:非空
*/
public static boolean isEmpty(Collection<?> coll)
{
return isNull(coll) || coll.isEmpty();
}

/**
* * 判断一个Collection是否非空,包含ListSetQueue
*
* @param coll 要判断的Collection
* @return true:非空 false:空
*/
public static boolean isNotEmpty(Collection<?> coll)
{
return !isEmpty(coll);
}

/**
* * 判断一个对象数组是否为空
*
* @param objects 要判断的对象数组
** @return true:为空 false:非空
*/
public static boolean isEmpty(Object[] objects)
{
return isNull(objects) || (objects.length == 0);
}

/**
* * 判断一个对象数组是否非空
*
* @param objects 要判断的对象数组
* @return true:非空 false:空
*/
public static boolean isNotEmpty(Object[] objects)
{
return !isEmpty(objects);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2021-08-16
  • 2021-06-16
  • 2021-11-02
  • 2021-07-03
  • 2022-12-23
猜你喜欢
  • 2022-02-12
  • 2021-06-25
  • 2021-07-02
  • 2021-07-25
  • 2021-12-22
  • 2021-10-03
  • 2021-05-18
相关资源
相似解决方案