Guava provides the Throwables class which contains a number of static utility methods to work with instances of Java Throwable. Exception handling is a common component in nearly all java programs and getting it correct and consistently printing out the right information can be tricky. Navigating stack traces is not always straightforward and extracting the relevant information is cumbersome. Thankfully, Throwables makes it much easier to print and extract the needed data.
Perhaps at the foundation of Guava are its utilities for working with Java collections. After all, Guava started at as The Google Collections Library. By far, more classes live in the com.google.common.collect package than any other proving its significance to Guava.
Unfortunately, the out-of-the-box tools for manipulating files, as well as, reading, and writing files Java provides are not as streamlined as they could be. Guava provides a number of utilities for working with Java File objects.
In this article, we will examine how and why to use Guava Preconditions. Guava Preconditions provide a number of static methods to verify a constructor or a method in Java is invoked with the proper arguments or parameters. Preconditions standardize the way an application handles such errors and eliminates the mundane task of repeatedly implementing similar blocks of code.