• Home
Name Date Size #Lines LOC

..--

.github/03-May-2024-123105

android/03-May-2024-499,954367,712

android-annotation-stubs/03-May-2024-533272

futures/03-May-2024-442201

guava/03-May-2024-178,35495,188

guava-bom/03-May-2024-5951

guava-gwt/03-May-2024-8,1984,971

guava-testlib/03-May-2024-48,40033,000

guava-tests/03-May-2024-289,823250,786

refactorings/03-May-2024-286206

util/03-May-2024-6634

.classpathD03-May-2024298 87

.gitattributesD03-May-2024196 1412

.gitignoreD03-May-2024145 2117

.projectD03-May-2024364 1817

Android.bpD03-May-20245.8 KiB194182

CONTRIBUTING.mdD03-May-20243.7 KiB8766

CONTRIBUTORSD03-May-20249 21

COPYINGD03-May-202411.1 KiB203169

CleanSpec.mkD03-May-20242.2 KiB500

METADATAD03-May-2024334 2019

MODULE_LICENSE_APACHE2D03-May-20240

NOTICED03-May-202411.1 KiB203169

OWNERSD03-May-202433 21

README.mdD03-May-20245.7 KiB13197

cycle_suppress_list.txtD03-May-20243.1 KiB5346

javadoc-stylesheet.cssD03-May-202411.2 KiB492488

pom.xmlD03-May-202414.4 KiB416387

README.md

1# Guava: Google Core Libraries for Java
2
3[![Latest release](https://img.shields.io/github/release/google/guava.svg)](https://github.com/google/guava/releases/latest)
4[![Build Status](https://github.com/google/guava/workflows/CI/badge.svg?branch=master)](https://github.com/google/guava/actions)
5
6Guava is a set of core Java libraries from Google that includes new collection types
7(such as multimap and multiset), immutable collections, a graph library, and
8utilities for concurrency, I/O, hashing, caching, primitives, strings, and more! It
9is widely used on most Java projects within Google, and widely used by many
10other companies as well.
11
12Guava comes in two flavors:
13
14*   The JRE flavor requires JDK 1.8 or higher.
15*   If you need support for Android, use the Android flavor. You can find the
16    Android Guava source in the [`android` directory].
17
18[`android` directory]: https://github.com/google/guava/tree/master/android
19
20## Adding Guava to your build
21
22Guava's Maven group ID is `com.google.guava`, and its artifact ID is `guava`.
23Guava provides two different "flavors": one for use on a (Java 8+) JRE and one
24for use on Android or by any library that wants to be compatible with Android.
25These flavors are specified in the Maven version field as either `31.1-jre` or
26`31.1-android`. For more about depending on Guava, see
27[using Guava in your build].
28
29To add a dependency on Guava using Maven, use the following:
30
31```xml
32<dependency>
33  <groupId>com.google.guava</groupId>
34  <artifactId>guava</artifactId>
35  <version>31.1-jre</version>
36  <!-- or, for Android: -->
37  <version>31.1-android</version>
38</dependency>
39```
40
41To add a dependency using Gradle:
42
43```gradle
44dependencies {
45  // Pick one:
46
47  // 1. Use Guava in your implementation only:
48  implementation("com.google.guava:guava:31.1-jre")
49
50  // 2. Use Guava types in your public API:
51  api("com.google.guava:guava:31.1-jre")
52
53  // 3. Android - Use Guava in your implementation only:
54  implementation("com.google.guava:guava:31.1-android")
55
56  // 4. Android - Use Guava types in your public API:
57  api("com.google.guava:guava:31.1-android")
58}
59```
60
61For more information on when to use `api` and when to use `implementation`,
62consult the
63[Gradle documentation on API and implementation separation](https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_separation).
64
65## Snapshots and Documentation
66
67Snapshots of Guava built from the `master` branch are available through Maven
68using version `HEAD-jre-SNAPSHOT`, or `HEAD-android-SNAPSHOT` for the Android
69flavor.
70
71-   Snapshot API Docs: [guava][guava-snapshot-api-docs]
72-   Snapshot API Diffs: [guava][guava-snapshot-api-diffs]
73
74## Learn about Guava
75
76-   Our users' guide, [Guava Explained]
77-   [A nice collection](http://www.tfnico.com/presentations/google-guava) of
78    other helpful links
79
80## Links
81
82-   [GitHub project](https://github.com/google/guava)
83-   [Issue tracker: Report a defect or feature request](https://github.com/google/guava/issues/new)
84-   [StackOverflow: Ask "how-to" and "why-didn't-it-work" questions](https://stackoverflow.com/questions/ask?tags=guava+java)
85-   [guava-announce: Announcements of releases and upcoming significant changes](http://groups.google.com/group/guava-announce)
86-   [guava-discuss: For open-ended questions and discussion](http://groups.google.com/group/guava-discuss)
87
88## IMPORTANT WARNINGS
89
901.  APIs marked with the `@Beta` annotation at the class or method level are
91    subject to change. They can be modified in any way, or even removed, at any
92    time. If your code is a library itself (i.e., it is used on the CLASSPATH of
93    users outside your own control), you should not use beta APIs unless you
94    [repackage] them. **If your code is a library, we strongly recommend using
95    the [Guava Beta Checker] to ensure that you do not use any `@Beta` APIs!**
96
972.  APIs without `@Beta` will remain binary-compatible for the indefinite
98    future. (Previously, we sometimes removed such APIs after a deprecation
99    period. The last release to remove non-`@Beta` APIs was Guava 21.0.) Even
100    `@Deprecated` APIs will remain (again, unless they are `@Beta`). We have no
101    plans to start removing things again, but officially, we're leaving our
102    options open in case of surprises (like, say, a serious security problem).
103
1043.  Guava has one dependency that is needed for linkage at runtime:
105    `com.google.guava:failureaccess:1.0.1`. It also has
106    [some annotation-only dependencies][guava-deps], which we discuss in more
107    detail at that link.
108
1094.  Serialized forms of ALL objects are subject to change unless noted
110    otherwise. Do not persist these and assume they can be read by a future
111    version of the library.
112
1135.  Our classes are not designed to protect against a malicious caller. You
114    should not use them for communication between trusted and untrusted code.
115
1166.  For the mainline flavor, we test the libraries using only OpenJDK 8 and
117    OpenJDK 11 on Linux. Some features, especially in `com.google.common.io`,
118    may not work correctly in other environments. For the Android flavor, our
119    unit tests also run on API level 15 (Ice Cream Sandwich).
120
121[guava-snapshot-api-docs]: https://guava.dev/releases/snapshot-jre/api/docs/
122[guava-snapshot-api-diffs]: https://guava.dev/releases/snapshot-jre/api/diffs/
123[Guava Explained]: https://github.com/google/guava/wiki/Home
124[Guava Beta Checker]: https://github.com/google/guava-beta-checker
125
126<!-- References -->
127
128[using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild
129[repackage]: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-if-i-want-to-use-beta-apis-from-a-library-that-people-use-as-a-dependency
130[guava-deps]: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies
131