Google Guava概述

Guava是来自Google的Java库合集,包含了很多新的集合类型(比如multinmap和mulitset),不可变集合,图库和并发、I/O、哈希、缓存、原始类型等类型的工具集。Guava广泛的使用在Google的大部分Java项目中,也被其他的公司广泛采用。
Guava有两种使用方式:

  • JRE方式,需要JDK1.8或者更高版本
  • 如果想要在JDK1.7或者Android中使用,需要采用Android方式

Guava的Maven group ID 是 com.google.guava, artifact ID是guava
若是使用Maven构建你的项目,你可以使用如下方式添加Guava依赖


com.google.guava
guava
29.0-jre

29.0-android

使用Gradle构建项目则采用如下方式

dependencies {
// Pick one:

// 1. Use Guava in your implementation only:
implementation("com.google.guava:guava:29.0-jre")

// 2. Use Guava types in your public API:
api("com.google.guava:guava:29.0-jre")

// 3. Android - Use Guava in your implementation only:
implementation("com.google.guava:guava:29.0-android")

// 4. Android - Use Guava types in your public API:
api("com.google.guava:guava:29.0-android")
}

如果想了解更多Guava的内容,请访问Guava Github地址

参考

posted @ 2020-05-25 09:33  weegee  阅读(849)  评论(0)    收藏  举报