|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .github/ | | 03-May-2024 | - | 123 | 105 |
| android/ | | 03-May-2024 | - | 499,954 | 367,712 |
| android-annotation-stubs/ | | 03-May-2024 | - | 533 | 272 |
| futures/ | | 03-May-2024 | - | 442 | 201 |
| guava/ | | 03-May-2024 | - | 178,354 | 95,188 |
| guava-bom/ | | 03-May-2024 | - | 59 | 51 |
| guava-gwt/ | | 03-May-2024 | - | 8,198 | 4,971 |
| guava-testlib/ | | 03-May-2024 | - | 48,400 | 33,000 |
| guava-tests/ | | 03-May-2024 | - | 289,823 | 250,786 |
| refactorings/ | | 03-May-2024 | - | 286 | 206 |
| util/ | | 03-May-2024 | - | 66 | 34 |
| .classpath | D | 03-May-2024 | 298 | 8 | 7 |
| .gitattributes | D | 03-May-2024 | 196 | 14 | 12 |
| .gitignore | D | 03-May-2024 | 145 | 21 | 17 |
| .project | D | 03-May-2024 | 364 | 18 | 17 |
| Android.bp | D | 03-May-2024 | 5.8 KiB | 194 | 182 |
| CONTRIBUTING.md | D | 03-May-2024 | 3.7 KiB | 87 | 66 |
| CONTRIBUTORS | D | 03-May-2024 | 9 | 2 | 1 |
| COPYING | D | 03-May-2024 | 11.1 KiB | 203 | 169 |
| CleanSpec.mk | D | 03-May-2024 | 2.2 KiB | 50 | 0 |
| METADATA | D | 03-May-2024 | 334 | 20 | 19 |
| MODULE_LICENSE_APACHE2 | D | 03-May-2024 | 0 | | |
| NOTICE | D | 03-May-2024 | 11.1 KiB | 203 | 169 |
| OWNERS | D | 03-May-2024 | 33 | 2 | 1 |
| README.md | D | 03-May-2024 | 5.7 KiB | 131 | 97 |
| cycle_suppress_list.txt | D | 03-May-2024 | 3.1 KiB | 53 | 46 |
| javadoc-stylesheet.css | D | 03-May-2024 | 11.2 KiB | 492 | 488 |
| pom.xml | D | 03-May-2024 | 14.4 KiB | 416 | 387 |
README.md
1# Guava: Google Core Libraries for Java
2
3[](https://github.com/google/guava/releases/latest)
4[](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