TopGit
GitHub Repo Review

Guava: Google's Core Java Library for Collections

google/guava
GTopGit review image for google/guava
Review by Topgit.dev for google/guava, with GitHub repository stats and README context.
Quick verdict

Guava is Google's own core Java library, and the README says it's used on most of Google's Java projects plus many outside companies too. Reach for it when you want proven multimap, multiset, and immutable collection builders instead of hand-rolling your own wrappers around HashMap and List. Skip it if your project is small enough that one more Maven dependency, plus its failureaccess runtime dependency, isn't worth the weight.

Stars
★ 51.7k
Forks
⑂ 11.2k
Language
Java
License
Apache-2.0
Topic
Backend
Updated
Aug 2026
Homepage
GitHub

Understanding Google Guava

Guava is Google's own Java toolbox that sits on top of java.util instead of replacing it. Inside: extra collection shapes like multimap and multiset, ready-made immutable collections, a graph library, plus helpers for concurrency, I/O, hashing, primitives, and strings. It isn't a framework you architect around — you add the dependency and import classes like ImmutableList where the standard library falls short.

Core Libraries and Utilities

  • Multimap and multiset collection types — one key mapping to many values, and a set that tracks how many times each element appears, neither of which java.util's collections framework gives you out of the box.
  • Immutable collection builders (like ImmutableList, browsable at guava.dev/ImmutableList) for data you want to guarantee callers can't mutate.
  • A graph library for representing and walking graph structures directly, instead of modeling nodes and edges by hand.
  • Concurrency utilities layered on top of java.util.concurrent, adding extra Java concurrency tools beyond what the JDK ships alone.
  • I/O utilities, though the README warns some com.google.common.io features may not work correctly outside Linux.
  • Hashing utilities alongside helpers for primitives and strings.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history

Integrating Guava into Your Build

Guava's Maven group ID is com.google.guava and its artifact ID is guava. Add version 33.6.0-jre if you're targeting a JRE (Java 8+), or 33.6.0-android if you need Android compatibility — the Android source lives in the repo's android directory. In Gradle, declare implementation("com.google.guava:guava:33.6.0-jre") for internal use, or swap implementation for api if Guava types show up in your own public API (the README points to Gradle's docs on that split). One thing to watch: Guava needs com.google.guava:failureaccess:1.0.3 at runtime for linkage, so make sure your dependency resolution doesn't strip it. If you want code straight from master, snapshot builds are published under 999.0.0-HEAD-jre-SNAPSHOT (or the -android equivalent).

Resources for Learning Guava

The README treats the Guava Explained wiki as the main guide for new users — that's the first stop for real usage patterns, not just method signatures. For method-level detail, the Javadoc lives at guava.dev/api, and you can jump straight to a class by appending its name, like guava.dev/ImmutableList. When you hit a real problem, the README routes how-to questions to the guava tag on StackOverflow and keeps GitHub issues for actual defects and feature requests. There are also two Google Groups: guava-announce for release news and guava-discuss for open-ended discussion.

Strengths

  • Multimap and multiset cover a real java.util gap instead of yet another Map<K, List<V>> you maintain by hand.
  • Non-@Beta APIs stay binary-compatible indefinitely, per the README — the last release that removed a non-Beta API was Guava 21.0, so you can build a public API on top without fear of routine breakage.
  • Apache-2.0 licensed — no copyleft to negotiate before shipping it in commercial code.
  • Two build flavors (JRE and Android) mean one library instead of maintaining separate collection utilities for each target.
  • 51,566 stars and 11,156 forks on GitHub — a plain sign real teams have adopted it, though that number alone isn't the reason to use it.

Important Usage Warnings

  • @Beta-annotated APIs can change or vanish at any release — risky if you're a library author whose users are outside your control; the README recommends running the separate Guava Beta Checker to catch accidental use.
  • Guava doesn't promise serialized objects stay readable across versions — the README warns that any object's serialized form can change without notice, so persisting one and expecting a later Guava release to deserialize it correctly is a bad bet.
  • Guava's classes aren't hardened against malicious input by design — the README says not to use them as a boundary between trusted and untrusted code.
  • I/O utilities carry a platform caveat: the README flags that some com.google.common.io features may not work correctly outside Linux.
  • Adding Guava also adds its failureaccess runtime dependency and some annotation-only dependencies — one more thing your dependency tree has to resolve cleanly.

Considering Other Java Utility Libraries

Apache Commons LangVavrEclipse Collections

Common Questions About Guava

What are the different Guava flavors available?

Guava ships in two flavors: a JRE flavor that needs JDK 1.8 or higher for regular Java projects, and an Android flavor for Android compatibility, with its source kept in the repo's android directory.

How do I add Guava to a Maven or Gradle project?

In Maven, set com.google.guava as the group ID and guava as the artifact ID, with version 33.6.0-jre or 33.6.0-android. In Gradle, use implementation("com.google.guava:guava:33.6.0-jre") — or api(...) instead of implementation(...) if Guava types appear in your own public API.

What does the `@Beta` annotation in Guava mean?

The @Beta annotation flags a class or method as unstable — Guava can change or remove it at any time, so the README tells library authors to avoid depending on @Beta APIs unless they repackage them, and points to the separate Guava Beta Checker tool.

Is Guava binary-compatible between versions?

Any Guava API that isn't marked @Beta stays binary-compatible indefinitely, according to the README, even deprecated ones. The last release that actually removed a non-Beta API was Guava 21.0.

Are Guava objects safe for serialization?

Not for long-term storage — the README warns that any object's serialized form can change without notice in a future release, so treating it as a stable format for persistence is a bad bet.

What are Guava's system requirements?

The JRE flavor needs JDK 1.8 or higher, and the Android flavor's unit tests run against API level 24 (Nougat). The README also notes the mainline flavor is tested on OpenJDK across Linux and Windows, with some com.google.common.io features flagged as unreliable outside Linux.

The problem it solves

Plain java.util has no map that holds more than one value per key, no set that counts duplicate elements, and no built-in way to hand back a collection you can actually guarantee is immutable — teams patch these gaps with ad hoc Map<K, List<V>> wrappers or Collections.unmodifiableList() calls that don't stop upstream code from mutating the backing list. That gap adds up fast. Guava packages exactly those gaps — multimap, multiset, immutable collection builders, a graph library, plus concurrency and I/O utilities — as one Java utility library instead of a pile of home-grown helper classes scattered across a codebase.

Best use cases

  • Modeling one-to-many relationships (tags per post, permissions per user) with Multimap instead of a hand-managed Map<K, List<V>>.
  • Handing back defensive, immutable snapshots of internal state with Guava's immutable collection builders.
  • Counting occurrences — word frequency, event counts — with Multiset instead of a manual Map<T, Integer> counter.
  • Representing and traversing graph structures with Guava's graph library instead of writing adjacency-list code by hand.
  • Layering extra concurrency utilities on top of java.util.concurrent in a Java 8+ backend.
  • Sharing one utility library across both JRE and Android targets instead of maintaining two.

Who should try it — and who should skip

Any Java or Android developer starting a new project who's tired of hand-writing multimap-style wrappers or immutable snapshot builders should add Guava on day one — it's a low-friction dependency for that job. Skip it if you're already standardized on Vavr or Eclipse Collections for the same work, since the overlap isn't worth carrying two libraries that solve the same problem.

Related repositories

Source & attribution

Facts, version numbers, and quotes in this review come from the google/guava GitHub repository README (github.com/google/guava).

GitHub data · last synced Aug 6, 2026Reviewed by Henry
Back to TopGit