Google core libraries for Java
Go to file
cpovirk 10c64d93b7 Internal change.
PiperOrigin-RevId: 688529810
2024-10-22 06:49:09 -07:00
.github Bump the github-actions group with 3 updates 2024-10-14 11:28:00 -07:00
.mvn/wrapper Bump Maven to 3.9.9 and Wrapper to 3.3.2. 2024-10-14 15:24:15 -07:00
android Internal change. 2024-10-22 06:49:09 -07:00
futures Copy sonatype-oss-release configuration from Guava to failureaccess. 2023-10-16 19:24:23 -07:00
guava Remove a couple more obsolete workarounds for FilterOutputStream trouble. 2024-10-21 10:44:34 -07:00
guava-bom Fix relativePath warning for guava-bom. 2020-12-10 10:48:57 -05:00
guava-gwt Suppress Error Prone findings locally. 2024-08-19 09:21:24 -07:00
guava-testlib Internal change. 2024-10-22 06:49:09 -07:00
guava-tests Complete the automatable migration to assertThrows. 2024-10-21 14:13:09 -07:00
integration-tests/gradle Include j2objc-annotations in the Gradle runtime classpath. 2024-09-23 10:17:08 -07:00
proguard Make our Android builds work with an Android bootclasspath. 2023-11-16 07:12:31 -08:00
refactorings This change suppresses DefaultPackage check for any java class which uses the default java package, in preparation for enabling a compiler error that will prevent new instances of the bug. 2020-04-20 14:51:33 -04:00
util Begin using Maven Wrapper. 2023-10-16 13:48:20 -07:00
.gitattributes Add a .gitattributes file to control line ending normalization, which is otherwise a mess that depends on each git client's settings. (See http://schacon.github.io/git/gitattributes.html and http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ for more about that.) 2014-11-04 16:50:10 -05:00
.gitignore Add .mvn/wrapper/maven-wrapper.jar to .gitignore. 2023-10-17 09:57:55 -07:00
CONTRIBUTING.md Update http:// links to https:// if available. 2023-11-17 10:47:47 -08:00
CONTRIBUTORS fix indentation 2011-04-14 12:11:40 +00:00
cycle_suppress_list.txt Internal change 2020-12-16 14:54:45 -05:00
javadoc-stylesheet.css Fix a couple of issues with JDK7 javadoc style by using a slightly customized version of the default stylesheet in Guava. Specific issues this fixes: 2013-07-17 17:01:06 -04:00
LICENSE Rename COPYING to LICENSE 2023-02-22 10:59:39 -08:00
mvnw Bump Maven to 3.9.9 and Wrapper to 3.3.2. 2024-10-14 15:24:15 -07:00
mvnw.cmd Bump Maven to 3.9.9 and Wrapper to 3.3.2. 2024-10-14 15:24:15 -07:00
overview.html Fix timestamp and comments. 2023-07-17 09:01:41 -07:00
pom.xml Make most util.concurrent Duration overloads available to Android users. 2024-10-18 17:51:36 -07:00
README.md Prepare for release 33.3.1. 2024-09-24 11:34:38 -07:00

Guava: Google Core Libraries for Java

Latest release Build Status OpenSSF Best Practices

Guava is a set of core Java libraries from Google that includes new collection types (such as multimap and multiset), immutable collections, a graph library, and utilities for concurrency, I/O, hashing, primitives, strings, and more! It is widely used on most Java projects within Google, and widely used by many other companies as well.

Guava comes in two flavors:

Adding Guava to your build

Guava's Maven group ID is com.google.guava, and its artifact ID is guava. Guava provides two different "flavors": one for use on a (Java 8+) JRE and one for use on Android or by any library that wants to be compatible with Android. These flavors are specified in the Maven version field as either 33.3.1-jre or 33.3.1-android. For more about depending on Guava, see using Guava in your build.

To add a dependency on Guava using Maven, use the following:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>33.3.1-jre</version>
  <!-- or, for Android: -->
  <version>33.3.1-android</version>
</dependency>

To add a dependency using Gradle:

dependencies {
  // Pick one:

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

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

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

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

For more information on when to use api and when to use implementation, consult the Gradle documentation on API and implementation separation.

Snapshots and Documentation

Snapshots of Guava built from the master branch are available through Maven using version HEAD-jre-SNAPSHOT, or HEAD-android-SNAPSHOT for the Android flavor.

  • Snapshot API Docs: guava
  • Snapshot API Diffs: guava

Learn about Guava

IMPORTANT WARNINGS

  1. APIs marked with the @Beta annotation at the class or method level are subject to change. They can be modified in any way, or even removed, at any time. If your code is a library itself (i.e., it is used on the CLASSPATH of users outside your own control), you should not use beta APIs unless you repackage them. If your code is a library, we strongly recommend using the Guava Beta Checker to ensure that you do not use any @Beta APIs!

  2. APIs without @Beta will remain binary-compatible for the indefinite future. (Previously, we sometimes removed such APIs after a deprecation period. The last release to remove non-@Beta APIs was Guava 21.0.) Even @Deprecated APIs will remain (again, unless they are @Beta). We have no plans to start removing things again, but officially, we're leaving our options open in case of surprises (like, say, a serious security problem).

  3. Guava has one dependency that is needed for linkage at runtime: com.google.guava:failureaccess:1.0.2. It also has some annotation-only dependencies, which we discuss in more detail at that link.

  4. Serialized forms of ALL objects are subject to change unless noted otherwise. Do not persist these and assume they can be read by a future version of the library.

  5. Our classes are not designed to protect against a malicious caller. You should not use them for communication between trusted and untrusted code.

  6. For the mainline flavor, we test the libraries using OpenJDK 8, 11, and 17 on Linux, with some additional testing on newer JDKs and on Windows. Some features, especially in com.google.common.io, may not work correctly in non-Linux environments. For the Android flavor, our unit tests also run on API level 21 (Lollipop).