Google Guava 工具类与 Kotlin 语言的设计对比
Guava工具类是什么
Guava is a suite of core and expanded libraries that include utility classes, google’s collections, io classes, and much much more.
Guava工程包含了若干被Google的 Java项目广泛依赖 的核心库,例如:集合 [collections] 、缓存 [caching] 、原生类型支持 [primitives support] 、并发库 [concurrency libraries] 、通用注解 [common annotations] 、字符串处理 [string processing] 、I/O 等等。 所有这些工具每天都在被Google的工程师应用在产品服务中。
在使用 Kotlin 的过程中,我们发现很多思想都来自于现有 Java 生态库。例如:Guava,Lombok,common-lang等等。
本文主要讲解 Guava 中的工具类的使用与 Kotlin 中同样的问题的解决方式。
guava功能介绍
guava 源码包说明:
- com.google.common.annotations:普通注解类型。
- com.go