Package com.google.common.base
@ParametersAreNonnullByDefault
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.-
ClassDescriptionAbsent<T>Implementation of an
Optional
not containing a reference.Note this class is a copy ofAbstractIterator
(for dependency reasons).Static methods pertaining to ASCII characters (those in the range of values0x00
through0x7F
), and to strings containing such characters.Utility class for converting between various ASCII case formats.Implementation ofCharMatcher.and(CharMatcher)
.Implementation ofCharMatcher.any()
.Implementation ofCharMatcher.anyOf(CharSequence)
for three or more characters.Implementation ofCharMatcher.ascii()
.Fast matcher using aBitSet
table of matching characters.Implementation ofCharMatcher.breakingWhitespace()
.Implementation ofCharMatcher.digit()
.A matcher for which precomputation will not yield any significant benefit.Implementation ofCharMatcher.forPredicate(Predicate)
.Implementation ofCharMatcher.inRange(char, char)
.Implementation ofCharMatcher.invisible()
.Implementation ofCharMatcher.is(char)
.Implementation ofCharMatcher.anyOf(CharSequence)
for exactly two characters.Implementation ofCharMatcher.isNot(char)
.Implementation ofCharMatcher.javaDigit()
.Implementation ofCharMatcher.javaIsoControl()
.Implementation ofCharMatcher.javaLetter()
.Implementation ofCharMatcher.javaLetterOrDigit()
.Implementation ofCharMatcher.javaLowerCase()
.Implementation ofCharMatcher.javaUpperCase()
.CharMatcher.FastMatcher
which overridestoString()
with a custom name.Implementation ofCharMatcher.Negated.negate()
.Negation of aCharMatcher.FastMatcher
.Implementation ofCharMatcher.none()
.Implementation ofCharMatcher.or(CharMatcher)
.Implementation that matches characters that fall within multiple ranges.Implementation ofCharMatcher.singleWidth()
.Implementation ofCharMatcher.whitespace()
.Contains constant definitions for the six standardCharset
instances, which are guaranteed to be supported by all Java platform implementations.The subset of theMatcher
API which is used by this package, and also shared with there2j
library.The subset of thePattern
API which is used by this package, and also shared with there2j
library.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.A converter that always converts or reverses an object to itself.This class provides default values for all Java types, as defined by the JLS.Marks all "top-level" types as non-null in a way that is recognized by Kotlin.Utility methods for working withEnum
instances.Enums.StringConverter<T extends Enum<T>>Equivalence<T>A strategy for determining whether two instances are considered equivalent, and for computing hash codes in a manner consistent with that equivalence.Wraps an object so thatEquivalence.Wrapper.equals(Object)
andEquivalence.Wrapper.hashCode()
delegate to anEquivalence
.Holder for extra methods ofObjects
only in web.Phantom reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.Implemented by references that have code to run after garbage collection of their referents.A reference queue with an associated background thread that dequeues references and invokesFinalizableReference.finalizeReferent()
on them.Try to load Finalizer in its own class loader.Loads Finalizer directly using the current class loader.Loads Finalizer.class.Tries to load Finalizer from the system class loader.Soft reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.Weak reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.Function<F,T> Legacy version ofjava.util.function.Function
.Equivalence applied on functional result.Static utility methods pertaining tocom.google.common.base.Function
instances; see that class for information about migrating tojava.util.function
.Disables Animal Sniffer's checking of compatibility with older versions of Java/Android.This class is forcom.google.common.base
use only!Wrappers aroundBuffer
methods that are covariantly overridden in Java 9+.A regex pattern implementation which is backed by thePattern
.An object that joins map entries in the same manner asJoiner
joins iterables and arrays.Helper functions that operate on anyObject
, and are not already provided inObjects
.Support class forMoreObjects.toStringHelper(java.lang.Object)
.Holder object for values that cannot be null or empty (will be printed unconditionally).A utility method to perform unchecked casts to suppress errors produced by nullness analyses.Helper functions that can operate on anyObject
.Optional<T>An immutable object that may contain a non-null reference to another object.PairwiseEquivalence<E,T extends E> Annotates a "top-level" type-variable usage that takes its nullness from the type argument supplied by the user of the class.Pluggable interface for compiling a regex pattern.Methods factored out so that they can be emulated differently in GWT.Static convenience methods that help a method or constructor check whether it was invoked correctly (that is, whether its preconditions were met).Predicate<T>Legacy version ofjava.util.function.Predicate
.Static utility methods pertaining toPredicate
instances.Present<T>Implementation of anOptional
containing a reference.An immutable version of CharMatcher for smallish sets of characters that uses a hash table with linear probing to check for matches.Extracts non-overlapping substrings from an input string, typically by recognizing appearances of a separator sequence.An object that splits strings into maps asSplitter
splits iterables and lists.Represents a standard system property.An object that accurately measures elapsed time: the measured duration between two successive readings of "now" in the same process.Static utility methods pertaining toString
orCharSequence
instances.Supplier<T>Legacy version ofjava.util.function.Supplier
.Useful suppliers.Static utility methods pertaining to instances ofThrowable
.A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.Low-level, high-performance utility methods related to the UTF-8 character encoding.Static convenience methods that serve the same purpose as Java language assertions, except that they are always enabled.Exception thrown upon the failure of a verification check, including those performed by the convenience methods of theVerify
class.