1# Guava: Google Core Libraries for Java 2 3[](https://github.com/google/guava/releases/latest) 4[](https://travis-ci.org/google/guava) 5 6Guava is a set of core libraries that includes new collection types (such as 7multimap and multiset), immutable collections, a graph library, functional 8types, an in-memory cache, and APIs/utilities for concurrency, I/O, hashing, 9primitives, reflection, string processing, and much more! 10 11Guava comes in two flavors. 12 13* The JRE flavor requires JDK 1.8 or higher. 14* If you need support for JDK 1.7 or Android, use the Android flavor. You can 15 find the Android Guava source in the [`android` directory]. 16 17[`android` directory]: https://github.com/google/guava/tree/master/android 18 19## Adding Guava to your build 20 21Guava's Maven group ID is `com.google.guava` and its artifact ID is `guava`. 22Guava provides two different "flavors": one for use on a (Java 8+) JRE and one 23for use on Android or Java 7 or by any library that wants to be compatible with 24either of those. These flavors are specified in the Maven version field as 25either `27.1-jre` or `27.1-android`. For more about depending on 26Guava, see [using Guava in your build]. 27 28To add a dependency on Guava using Maven, use the following: 29 30```xml 31<dependency> 32 <groupId>com.google.guava</groupId> 33 <artifactId>guava</artifactId> 34 <version>27.1-jre</version> 35 <!-- or, for Android: --> 36 <version>27.1-android</version> 37</dependency> 38``` 39 40To add a dependency using Gradle: 41 42```gradle 43dependencies { 44 compile 'com.google.guava:guava:27.1-jre' 45 // or, for Android: 46 api 'com.google.guava:guava:27.1-android' 47} 48``` 49 50## Snapshots 51 52Snapshots of Guava built from the `master` branch are available through Maven 53using version `HEAD-jre-SNAPSHOT`, or `HEAD-android-SNAPSHOT` for the Android 54flavor. 55 56- Snapshot API Docs: [guava][guava-snapshot-api-docs] 57- Snapshot API Diffs: [guava][guava-snapshot-api-diffs] 58 59## Learn about Guava 60 61- Our users' guide, [Guava Explained] 62- [A nice collection](http://www.tfnico.com/presentations/google-guava) of other helpful links 63 64## Links 65 66- [GitHub project](https://github.com/google/guava) 67- [Issue tracker: Report a defect or feature request](https://github.com/google/guava/issues/new) 68- [StackOverflow: Ask "how-to" and "why-didn't-it-work" questions](https://stackoverflow.com/questions/ask?tags=guava+java) 69- [guava-discuss: For open-ended questions and discussion](http://groups.google.com/group/guava-discuss) 70 71## IMPORTANT WARNINGS 72 731. APIs marked with the `@Beta` annotation at the class or method level 74are subject to change. They can be modified in any way, or even 75removed, at any time. If your code is a library itself (i.e. it is 76used on the CLASSPATH of users outside your own control), you should 77not use beta APIs, unless you [repackage] them. **If your 78code is a library, we strongly recommend using the [Guava Beta Checker] to 79ensure that you do not use any `@Beta` APIs!** 80 812. APIs without `@Beta` will remain binary-compatible for the indefinite 82future. (Previously, we sometimes removed such APIs after a deprecation period. 83The last release to remove non-`@Beta` APIs was Guava 21.0.) Even `@Deprecated` 84APIs will remain (again, unless they are `@Beta`). We have no plans to start 85removing things again, but officially, we're leaving our options open in case 86of surprises (like, say, a serious security problem). 87 883. Guava has one dependency that is needed at runtime: 89`com.google.guava:failureaccess:1.0` 90 914. Serialized forms of ALL objects are subject to change unless noted 92otherwise. Do not persist these and assume they can be read by a 93future version of the library. 94 955. Our classes are not designed to protect against a malicious caller. 96You should not use them for communication between trusted and 97untrusted code. 98 996. For the mainline flavor, we unit-test the libraries using only OpenJDK 1.8 on 100Linux. Some features, especially in `com.google.common.io`, may not work 101correctly in other environments. For the Android flavor, our unit tests run on 102API level 15 (Ice Cream Sandwich). 103 104[guava-snapshot-api-docs]: https://google.github.io/guava/releases/snapshot-jre/api/docs/ 105[guava-snapshot-api-diffs]: https://google.github.io/guava/releases/snapshot-jre/api/diffs/ 106[Guava Explained]: https://github.com/google/guava/wiki/Home 107[Guava Beta Checker]: https://github.com/google/guava-beta-checker 108 109<!-- References --> 110 111[using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild 112[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 113 114