@CheckReturnValue @NullMarked
Package com.google.common.base
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 Interface Description FinalizableReference Implemented by references that have code to run after garbage collection of their referents.Function<F extends @Nullable Object,T extends @Nullable Object> Legacy version ofjava.util.function.Function
.Predicate<T extends @Nullable Object> Legacy version ofjava.util.function.Predicate
.Supplier<T extends @Nullable Object> Legacy version ofjava.util.function.Supplier
. -
Class Summary Class Description Ascii Static methods pertaining to ASCII characters (those in the range of values0x00
through0x7F
), and to strings containing such characters.CharMatcher Charsets Contains constant definitions for the six standardCharset
instances, which are guaranteed to be supported by all Java platform implementations.Converter<A,B> A function fromA
toB
with an associated reverse function fromB
toA
; used for converting back and forth between different representations of the same information.Defaults This class provides default values for all Java types, as defined by the JLS.Enums Utility methods for working withEnum
instances.Equivalence<T> A strategy for determining whether two instances are considered equivalent, and for computing hash codes in a manner consistent with that equivalence.Equivalence.Wrapper<T extends @Nullable Object> Wraps an object so thatEquivalence.Wrapper.equals(Object)
andEquivalence.Wrapper.hashCode()
delegate to anEquivalence
.FinalizablePhantomReference<T> Phantom reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.FinalizableReferenceQueue A reference queue with an associated background thread that dequeues references and invokesFinalizableReference.finalizeReferent()
on them.FinalizableSoftReference<T> Soft reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.FinalizableWeakReference<T> Weak reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.Functions Static utility methods pertaining tocom.google.common.base.Function
instances; see that class for information about migrating tojava.util.function
.Joiner Joiner.MapJoiner An object that joins map entries in the same manner asJoiner
joins iterables and arrays.MoreObjects Helper functions that operate on anyObject
, and are not already provided inObjects
.MoreObjects.ToStringHelper Support class forMoreObjects.toStringHelper(java.lang.Object)
.Objects Helper functions that can operate on anyObject
.Optional<T> An immutable object that may contain a non-null reference to another object.Preconditions Static convenience methods that help a method or constructor check whether it was invoked correctly (that is, whether its preconditions were met).Predicates Static utility methods pertaining toPredicate
instances.Splitter Extracts non-overlapping substrings from an input string, typically by recognizing appearances of a separator sequence.Splitter.MapSplitter An object that splits strings into maps asSplitter
splits iterables and lists.Stopwatch An object that accurately measures elapsed time: the measured duration between two successive readings of "now" in the same process.Strings Static utility methods pertaining toString
orCharSequence
instances.Suppliers Useful suppliers.Throwables Static utility methods pertaining to instances ofThrowable
.Ticker A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.Utf8 Low-level, high-performance utility methods related to the UTF-8 character encoding.Verify Static convenience methods that serve the same purpose as Java language assertions, except that they are always enabled. -
Enum Summary Enum Description CaseFormat Utility class for converting between various ASCII case formats.StandardSystemProperty Represents a standard system property. -
Exception Summary Exception Description VerifyException Exception thrown upon the failure of a verification check, including those performed by the convenience methods of theVerify
class.