Disclaimer: I'm not affiliated with Google in any way. I just think these are some great libraries that every Java project should include in the classpath!
The Google Guava Libraries are a nice set of Java utility classes that will probably come in handy in any project. Stuff like immutable collections, string manipulation, handling primitives and easier I/O are some of the concepts they deal with. Unfortunately, the Guava wiki is rather scrawny (UPDATE: Not so scrawny any more!), so I've created this page to collect documentation from around the web.
Note that Google Guava now includes the older Google Collections classes. Make sure that you don't have both libraries in your classpath.
How to add Guava as a Maven dependency
Search Maven central for the version of Guava you want, and then paste the snippet into your pom.xml:
Note that the version number in the snippet above might be outdated.
Added 29.12.15: Eugen Baeldung updates us on the latest changes in Guava:
Added 14.02.14: Sezin Karli has done a nice tour of all the Guava basics:
Added 15.01.14: Level up Lunch features a bunch of Guava examples and one tutorial:
Added 20.11.13: Kevin Bourrillion guests on the Java Posse podcast to talk about Guava:
Added 21.10.13: Bill Bejeck has written a book about Google Guava:
Added 20.02.12: Kevin Bourrillion does a big tour of Guava at QCon November 2012:
Added 20.02.12: Stay up to date with Guava development on their Google+ page:
Added 15.12.12: Another introduction by Mite Mitreski (slide-set and links):
Added 10.12.12: Introduction to Guava by Bhavin Parikh (slide-set):
Added 10.07.12: EclipseSource article showing off CacheBuilder/LoadingCache:
Added 06.06.12: A quick introduction article from EclipseSource:
Added 05.06.12: Cyrille Martraire has a series on functional Java with Guava:
- A touch of functional style in plain Java with predicates – Part 1
- A touch of functional style in plain Java with predicates – Part 2
Added 05.06.12: Tom Jefferys discusses String splitting:
Added 23.12.11: GuavaExplained - The official Guava wiki finally gets some proper content:
Added 23.12.11: Examples on sorting collections from polygenelubricants:
Added 17.11.11: An example from the Guava Concurrency utils, by Bill Bejeck:
Added 19.10.11: An example of using the new Guava EventBus:
Added 19.10.11: How to do Commons Collections stuff with Guava:
Added 23.04.11: Presentation from the Guava team about util.concurrent:
Added 09.02.11: Google Guava vs Apache Commons for arg validation:
Added 22.01.11: Google Guava v07 examples, by Jakub Nabrdalik:
Added 22.01.11: Kevin Bourrillion presents Guava @NetFlix, 2010-04-26
Added 20.01.11: Discussions on StackOverflow of Guava vs Apache Commons:
- What are the big improvements between Guava and Apache equivalent libraries?
- Apache-Commons vs Google-Collections
Added 19.01.11: Read the test source:
- The Google Guava Test sources give some examples of usage.
A five-part, quite extensive tutorial from Sezin Karli:
- Part 1: Fun with string-related stuff
- Part 2: Joys of ordering
- Part 3: Taste the functional programming flavor in Java
- Part 4: Taste the functional programming flavor with predicates
- Part 5: Back to the primitive(s)
Google Guava, the easy parts. A basic tutorial that recently surfaced on DZone:
A collection of short snippets (great mini reference for Google Collections):
Codemunchies' 4 part series on Google Collections and Guava:
- Part 1: Beautiful code with Google Collections, Guava and static imports
- Part 2: Diving into the Guava library
- Part 3: Functional Java, Filtering and Ordering
- Part 4: Preconditions, MultiMaps, and Partitioning
Another intro to Google Collections:
And yet another intro, from JayWay:
Creating a fluent interface, improving on Google Collections (advanced):
And if you're curious about the whole rationale behind GC, you can watch the whole video from the creators (including comments from Josh Bloch, who created the java.util collections in the first place):
This is a presentation I created about Google Guava some years ago:
You can find the code from this presentation on GitHub.