Top Description Interfaces Annotations Classes Enums
[default module]

Package com.google.common.base

Annotations
@CheckReturnValue
@ParametersAreNonnullByDefault
Imports
com.google.errorprone.annotations.CheckReturnValue, javax.annotation.ParametersAreNonnullByDefault

Basic utility libraries and interfaces.

This package is a part of the open-source Guava library.

Contents

The classes in this package that are most commonly useful are:

String utilities

Function types

Other

The rest

This package also contains some classes with niche use cases (e.g., Utf8 and Defaults), as well as a number of classes that have been superseded by additions to the JDK.

Interface Summary

Modifier and TypeInterface and Description
public interface
FinalizableReference

Implemented by references that have code to run after garbage collection of their referents.

public interface
Function<F extends @Nullable Object, T extends @Nullable Object>

Legacy version of java.util.function.Function.

pack-priv interface
PatternCompiler

Pluggable interface for compiling a regex pattern.

public interface
public interface

Annotation Summary

Modifier and TypeAnnotation and Description
pack-priv @interface
ElementTypesAreNonnullByDefault

Marks all "top-level" types as non-null in a way that is recognized by Kotlin.

pack-priv @interface
ParametricNullness

Annotates a "top-level" type-variable usage that takes its nullness from the type argument supplied by the user of the class.

Class Summary

Modifier and TypeClass and Description
pack-priv class
Absent<T>

Implementation of an Optional not containing a reference.

pack-priv abstract class
AbstractIterator<T extends @Nullable Object>

Note this class is a copy of com.google.common.collect.AbstractIterator (for dependency reasons).

public class
Ascii

Static methods pertaining to ASCII characters (those in the range of values 0x00 through 0x7F), and to strings containing such characters.

public abstract class
CharMatcher

Determines a true or false value for any Java char value, just as Predicate does for any Object.

public class
Charsets

Contains constant definitions for the six standard Charset instances, which are guaranteed to be supported by all Java platform implementations.

pack-priv abstract class
CommonMatcher

The subset of the java.util.regex.Matcher API which is used by this package, and also shared with the re2j library.

pack-priv abstract class
CommonPattern

The subset of the java.util.regex.Pattern API which is used by this package, and also shared with the re2j library.

public abstract class
Converter<A, B>

A function from A to B with an associated reverse function from B to A; used for converting back and forth between different representations of the same information.

public class
Defaults

This class provides default values for all Java types, as defined by the JLS.

public class
Enums

Utility methods for working with Enum instances.

public abstract class
Equivalence<T>

A strategy for determining whether two instances are considered equivalent, and for computing hash codes in a manner consistent with that equivalence.

pack-priv abstract class
ExtraObjectsMethodsForWeb

Holder for extra methods of Objects only in web.

public abstract class
FinalizablePhantomReference<T>

Phantom reference with a finalizeReferent() method which a background thread invokes after the garbage collector reclaims the referent.

public class
FinalizableReferenceQueue

A reference queue with an associated background thread that dequeues references and invokes FinalizableReference#finalizeReferent() on them.

public abstract class
FinalizableSoftReference<T>

Soft reference with a finalizeReferent() method which a background thread invokes after the garbage collector reclaims the referent.

public abstract class
FinalizableWeakReference<T>

Weak reference with a finalizeReferent() method which a background thread invokes after the garbage collector reclaims the referent.

pack-priv class
FunctionalEquivalence<F, T>

Equivalence applied on functional result.

public class
Functions

Static utility methods pertaining to com.google.common.base.Function instances; see that class for information about migrating to java.util.function.

pack-priv class
Java8Compatibility

Wrappers around Buffer methods that are covariantly overridden in Java 9+.

pack-priv class
JdkPattern

A regex pattern implementation which is backed by the Pattern.

public class
Joiner

An object which joins pieces of text (specified as an array, Iterable, varargs or even a Map) with a separator.

public class
MoreObjects

Helper functions that operate on any Object, and are not already provided in java.util.Objects.

pack-priv class
NullnessCasts

A utility method to perform unchecked casts to suppress errors produced by nullness analyses.

public class
Objects

Helper functions that can operate on any Object.

public abstract class
Optional<
the type of instance that can be contained. Optional is naturally covariant on this type, so it is safe to cast an Optional<T> to Optional<S> for any supertype S of T.
T
>

An immutable object that may contain a non-null reference to another object.

pack-priv class
pack-priv class
Platform

Methods factored out so that they can be emulated differently in GWT.

public class
Preconditions

Static convenience methods that help a method or constructor check whether it was invoked correctly (that is, whether its preconditions were met).

public class
Predicates

Static utility methods pertaining to Predicate instances.

pack-priv class
Present<T>

Implementation of an Optional containing a reference.

pack-priv class
SmallCharMatcher

An immutable version of CharMatcher for smallish sets of characters that uses a hash table with linear probing to check for matches.

public class
Splitter

Extracts non-overlapping substrings from an input string, typically by recognizing appearances of a separator sequence.

public class
Stopwatch

An object that accurately measures elapsed time: the measured duration between two successive readings of "now" in the same process.

public class
Strings

Static utility methods pertaining to String or CharSequence instances.

public class
Suppliers

Useful suppliers.

public class
Throwables

Static utility methods pertaining to instances of Throwable.

public abstract class
Ticker

A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.

public class
Utf8

Low-level, high-performance utility methods related to the UTF-8 character encoding.

public class
Verify

Static convenience methods that serve the same purpose as Java language assertions, except that they are always enabled.

public class
VerifyException

Exception thrown upon the failure of a verification check, including those performed by the convenience methods of the Verify class.

Enum Summary

Modifier and TypeEnum and Description
public enum
CaseFormat

Utility class for converting between various ASCII case formats.

public enum