commons-lang3工具包

1、添加pom文件

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-lang3</artifactId>
  <version>3.7</version>
</dependency>

2、src代码:

public static void main(String[] args) {
    System.out.println(StringUtils.isEmpty(null));
    System.out.println(StringUtils.isEmpty(""));

    System.out.println(ObjectUtils.anyNotNull(null, null));
    System.out.println(ObjectUtils.anyNotNull(11, null));

    System.out.println(RandomUtils.nextBoolean());
    System.out.println(RandomUtils.nextBoolean());

    System.out.println(SystemUtils.JAVA_HOME);
}

3、总结:

官网说commons-lang3主要目的是提供更多的工具类,其实也就是方便我们的开发,具体API需要自己研究。

官网:http://commons.apache.org/proper/commons-lang/index.html

发布了134 篇原创文章 · 获赞 32 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/yang_guang3/article/details/104302671