模块 wjybxx.base
程序包 cn.wjybxx.base

类 ObjectUtils

java.lang.Object
cn.wjybxx.base.ObjectUtils

public class ObjectUtils extends Object
一些基础的扩展
作者:
wjybxx date - 2023/4/17
  • 构造器详细资料

    • ObjectUtils

      public ObjectUtils()
  • 方法详细资料

    • nullToDef

      public static <V> V nullToDef(V obj, V def)
      如果给定参数为null,则返回给定的默认值,否则返回值本身 Objects.requireNonNullElse(Object, Object)不允许def为null
    • hashCode

      public static int hashCode(Object first)
    • hashCode

      public static int hashCode(Object first, Object second)
    • hashCode

      public static int hashCode(Object first, Object second, Object third)
    • hashCode

      public static int hashCode(Object... args)
    • toString

      public static String toString(Object object, String nullDef)
    • toStringIfNotNull

      public static String toStringIfNotNull(Object object)
    • length

      public static int length(CharSequence cs)
    • isEmpty

      public static boolean isEmpty(CharSequence cs)
    • isBlank

      public static boolean isBlank(CharSequence cs)
    • emptyToDef

      public static <T extends CharSequence> T emptyToDef(T str, T def)
      空字符串转默认字符串
    • blankToDef

      public static <T extends CharSequence> T blankToDef(T str, T def)
      空白字符串转默认字符串
    • emptyToDef

      public static String emptyToDef(String str, String def)
      空字符串转默认字符串 -- 避免string泛型转换
    • blankToDef

      public static String blankToDef(String str, String def)
      空白字符串转默认字符串 -- 避免string泛型转换
    • lastChar

      public static char lastChar(CharSequence value)
      获取字符串的尾字符
    • firstCharToUpperCase

      public static String firstCharToUpperCase(String str)
      首字母大写
    • firstCharToLowerCase

      public static String firstCharToLowerCase(String str)
      首字母小写
    • containsWhitespace

      public static boolean containsWhitespace(CharSequence cs)
      是否包含不可见字符