Uses of Annotation Type
com.google.common.annotations.J2ktIncompatible
Packages that use J2ktIncompatible
Package
Description
Basic utility libraries and interfaces.
This package contains generic collection interfaces and implementations, and other utilities for
working with collections.
This package contains utility methods and classes for working with Java I/O; for example input
streams, output streams, readers, writers, and files.
Arithmetic functions operating on primitive values and
BigInteger
instances.This package contains utility methods and classes for working with net addresses (numeric IP and
domain names).
Static utilities for working with the eight primitive types and
void
, and value types for
treating them as unsigned.Concurrency utilities.
-
Uses of J2ktIncompatible in com.google.common.base
Classes in com.google.common.base with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionfinal class
This class provides default values for all Java types, as defined by the JLS.final class
Utility methods for working withEnum
instances.class
Phantom reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.interface
Implemented by references that have code to run after garbage collection of their referents.class
A reference queue with an associated background thread that dequeues references and invokesFinalizableReference.finalizeReferent()
on them.class
Soft reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.class
Weak reference with afinalizeReferent()
method which a background thread invokes after the garbage collector reclaims the referent.enum
Represents a standard system property.Fields in com.google.common.base with annotations of type J2ktIncompatibleModifier and TypeFieldDescriptionstatic final Charset
Charsets.US_ASCII
US-ASCII: seven-bit ASCII, the Basic Latin block of the Unicode character set (ISO646-US).static final Charset
Charsets.UTF_16
UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark.static final Charset
Charsets.UTF_16BE
UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.static final Charset
Charsets.UTF_16LE
UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.Methods in com.google.common.base with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionstatic Predicate
<CharSequence> Returns a predicate that evaluates totrue
if theCharSequence
being tested contains any match for the given regular expression pattern.static Predicate
<CharSequence> Predicates.containsPattern
(String pattern) Returns a predicate that evaluates totrue
if theCharSequence
being tested contains any match for the given regular expression pattern.Stopwatch.elapsed()
Returns the current elapsed time shown on this stopwatch as aDuration
.static <X extends Throwable>
XThrowables.getCauseAs
(Throwable throwable, Class<X> expectedCauseType) Returnsthrowable
's cause, cast toexpectedCauseType
.static List
<StackTraceElement> Throwables.lazyStackTrace
(Throwable throwable) Deprecated.static boolean
Throwables.lazyStackTraceIsLazy()
Deprecated.This method always returns false on JDK versions past JDK 8 and on all Android versions.static Splitter
Returns a splitter that considers any subsequence matchingpattern
to be a separator.static Splitter
Returns a splitter that considers any subsequence matching a given pattern (regular expression) to be a separator.static RuntimeException
Deprecated.Usethrow e
orthrow new RuntimeException(e)
directly, or use a combination ofThrowables.throwIfUnchecked(java.lang.Throwable)
andthrow new RuntimeException(e)
.static <X extends Throwable>
voidThrowables.propagateIfInstanceOf
(Throwable throwable, Class<X> declaredType) Deprecated.UseThrowables.throwIfInstanceOf(java.lang.Throwable, java.lang.Class<X>)
, which has the same behavior but rejectsnull
.static void
Throwables.propagateIfPossible
(Throwable throwable) Deprecated.UseThrowables.throwIfUnchecked(java.lang.Throwable)
, which has the same behavior but rejectsnull
.static <X extends Throwable>
voidThrowables.propagateIfPossible
(Throwable throwable, Class<X> declaredType) Propagatesthrowable
exactly as-is, if and only if it is an instance ofRuntimeException
,Error
, ordeclaredType
.Throwables.propagateIfPossible
(Throwable throwable, Class<X1> declaredType1, Class<X2> declaredType2) Propagatesthrowable
exactly as-is, if and only if it is an instance ofRuntimeException
,Error
,declaredType1
, ordeclaredType2
.Returns a predicate that evaluates totrue
if the class being tested is assignable to (is a subtype of)clazz
.static <X extends Throwable>
voidThrowables.throwIfInstanceOf
(Throwable throwable, Class<X> declaredType) Throwsthrowable
if it is an instance ofdeclaredType
. -
Uses of J2ktIncompatible in com.google.common.collect
Classes in com.google.common.collect with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionfinal class
A multiset that supports concurrent modifications and that provides atomic versions of mostMultiset
operations (exceptions where noted).final class
ABiMap
backed by twoEnumMap
instances.final class
EnumHashBiMap<K extends Enum<K>,
V extends @Nullable Object> ABiMap
backed by anEnumMap
instance for keys-to-values, and aHashMap
instance for values-to-keys.final class
EnumMultiset<E extends Enum<E>>
Multiset implementation specialized for enum elements, supporting all single-element operations in O(1).class
Deprecated.This class has moved tocom.google.common.util.concurrent
.class
ForwardingDeque<E extends @Nullable Object>
A deque which forwards all its method calls to another deque.interface
Interner<E>
Provides similar behavior toString.intern()
for any immutable type.final class
Contains static methods pertaining to instances ofInterner
.final class
A builder ofConcurrentMap
instances that can have keys or values automatically wrapped in weak references.final class
MutableClassToInstanceMap<B extends @Nullable Object>
A mutable class-to-instance map backed by an arbitrary user-provided map.Methods in com.google.common.collect with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionOrdering.arbitrary()
Returns an arbitrary ordering over all objects, for whichcompare(a, b) == 0
impliesa == b
(identity equality).Sets.complementOf
(Collection<E> collection) Creates anEnumSet
consisting of all enum values that are not in the specified collection.static <E> int
Queues.drain
(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit) Drains the queue asBlockingQueue.drainTo(Collection, int)
, but if the requestednumElements
elements are not available, it will wait for them up to the specified timeout.static <E> int
Queues.drain
(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout) Drains the queue asBlockingQueue.drainTo(Collection, int)
, but if the requestednumElements
elements are not available, it will wait for them up to the specified timeout.static <E> int
Queues.drainUninterruptibly
(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit) Drains the queue as Queues.drain(BlockingQueue, Collection, int, long, TimeUnit), but with a different behavior in case it is interrupted while waiting.static <E> int
Queues.drainUninterruptibly
(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout) Drains the queue as Queues.drain(BlockingQueue, Collection, int, Duration), but with a different behavior in case it is interrupted while waiting.static ImmutableMap
<String, String> Maps.fromProperties
(Properties properties) Creates anImmutableMap<String, String>
from aProperties
instance.static <K extends Enum<K>,
V>
ImmutableMap<K, V> Maps.immutableEnumMap
(Map<K, ? extends V> map) Returns an immutable map instance containing the given entries.static <E> ArrayBlockingQueue
<E> Queues.newArrayBlockingQueue
(int capacity) Creates an emptyArrayBlockingQueue
with the given (fixed) capacity and nonfair access policy.static <E> ConcurrentLinkedQueue
<E> Queues.newConcurrentLinkedQueue()
Creates an emptyConcurrentLinkedQueue
.static <E> ConcurrentLinkedQueue
<E> Queues.newConcurrentLinkedQueue
(Iterable<? extends E> elements) Creates aConcurrentLinkedQueue
containing the elements of the specified iterable, in the order they are returned by the iterable's iterator.static <E extends @Nullable Object>
CopyOnWriteArrayList<E> Lists.newCopyOnWriteArrayList()
Creates an emptyCopyOnWriteArrayList
instance.static <E extends @Nullable Object>
CopyOnWriteArrayList<E> Lists.newCopyOnWriteArrayList
(Iterable<? extends E> elements) Creates aCopyOnWriteArrayList
instance containing the given elements.static <E extends @Nullable Object>
CopyOnWriteArraySet<E> Sets.newCopyOnWriteArraySet()
Creates an emptyCopyOnWriteArraySet
instance.static <E extends @Nullable Object>
CopyOnWriteArraySet<E> Sets.newCopyOnWriteArraySet
(Iterable<? extends E> elements) Creates aCopyOnWriteArraySet
instance containing the given elements.static <E> LinkedBlockingDeque
<E> Queues.newLinkedBlockingDeque()
Creates an emptyLinkedBlockingDeque
with a capacity ofInteger.MAX_VALUE
.static <E> LinkedBlockingDeque
<E> Queues.newLinkedBlockingDeque
(int capacity) Creates an emptyLinkedBlockingDeque
with the given (fixed) capacity.static <E> LinkedBlockingDeque
<E> Queues.newLinkedBlockingDeque
(Iterable<? extends E> elements) Creates aLinkedBlockingDeque
with a capacity ofInteger.MAX_VALUE
, containing the elements of the specified iterable, in the order they are returned by the iterable's iterator.static <E> LinkedBlockingQueue
<E> Queues.newLinkedBlockingQueue()
Creates an emptyLinkedBlockingQueue
with a capacity ofInteger.MAX_VALUE
.static <E> LinkedBlockingQueue
<E> Queues.newLinkedBlockingQueue
(int capacity) Creates an emptyLinkedBlockingQueue
with the given (fixed) capacity.static <E> LinkedBlockingQueue
<E> Queues.newLinkedBlockingQueue
(Iterable<? extends E> elements) Creates aLinkedBlockingQueue
with a capacity ofInteger.MAX_VALUE
, containing the elements of the specified iterable, in the order they are returned by the iterable's iterator.static <E extends Comparable>
PriorityBlockingQueue<E> Queues.newPriorityBlockingQueue()
Creates an emptyPriorityBlockingQueue
with the ordering given by its elements' natural ordering.static <E extends Comparable>
PriorityBlockingQueue<E> Queues.newPriorityBlockingQueue
(Iterable<? extends E> elements) Creates aPriorityBlockingQueue
containing the given elements.static <E> SynchronousQueue
<E> Queues.newSynchronousQueue()
Creates an emptySynchronousQueue
with nonfair access policy.Object[]
EvictingQueue.toArray()
final Object[]
ImmutableCollection.toArray()
Object[]
MinMaxPriorityQueue.toArray()
static <T extends @Nullable Object,
K extends Enum<K>, V>
Collector<T, ?, ImmutableMap<K, V>> Maps.toImmutableEnumMap
(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) Returns aCollector
that accumulates elements into anImmutableMap
whose keys and values are the result of applying the provided mapping functions to the input elements.static <T extends @Nullable Object,
K extends Enum<K>, V>
Collector<T, ?, ImmutableMap<K, V>> Maps.toImmutableEnumMap
(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction) Returns aCollector
that accumulates elements into anImmutableMap
whose keys and values are the result of applying the provided mapping functions to the input elements. -
Uses of J2ktIncompatible in com.google.common.io
Classes in com.google.common.io with annotations of type J2ktIncompatibleModifier and TypeInterfaceDescriptioninterface
An extension ofDataInput
for reading from in-memory byte arrays; its methods offer identical functionality but do not throwIOException
.interface
An extension ofDataOutput
for writing to in-memory byte arrays; its methods offer identical functionality but do not throwIOException
.interface
ByteProcessor<T extends @Nullable Object>
A callback interface to process bytes from a stream.class
A destination to which bytes can be written, such as a file.class
A readable source of bytes, such as a file.final class
Provides utility methods for working with byte arrays and I/O streams.class
A destination to which characters can be written, such as a text file.class
A readable source of characters, such as a text file.final class
Provides utility methods for working with character streams.final class
Utility methods for working withCloseable
objects.final class
final class
AnInputStream
that counts the number of bytes read.final class
An OutputStream that counts the number of bytes written.final class
AnOutputStream
that starts buffering to a byte array, but switches to file buffering once the data reaches a configurable size.final class
Provides utility methods for working with files.enum
Modes for opening a file for writing.final class
Utility methods for working withFlushable
objects.final class
Exception indicating that a recursive delete can't be performed because the file system does not have the support necessary to guarantee that it is not vulnerable to race conditions that would allow it to delete files and directories outside of the directory being deleted (i.e.,SecureDirectoryStream
is not supported).interface
LineProcessor<T extends @Nullable Object>
A callback to be used with the streamingreadLines
methods.final class
A class for reading lines of text.final class
An implementation ofDataInput
that uses little-endian byte ordering for readingshort
,int
,float
,double
, andlong
values.final class
An implementation ofDataOutput
that uses little-endian byte ordering for writingchar
,short
,int
,float
,double
, andlong
values.final class
final class
File name filter that only accepts files matching a regular expression.enum
Options for use with recursive delete methods (MoreFiles.deleteRecursively(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)
andMoreFiles.deleteDirectoryContents(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)
).final class
Provides utility methods for working with resources in the classpath.Methods in com.google.common.io with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionfinal ByteSource
BaseEncoding.decodingSource
(CharSource encodedSource) Returns aByteSource
that reads base-encoded bytes from the specifiedCharSource
.abstract InputStream
BaseEncoding.decodingStream
(Reader reader) Returns anInputStream
that decodes base-encoded input from the specifiedReader
.final ByteSink
BaseEncoding.encodingSink
(CharSink encodedSink) Returns aByteSink
that writes base-encoded bytes to the specifiedCharSink
.abstract OutputStream
BaseEncoding.encodingStream
(Writer writer) Returns anOutputStream
that encodes bytes using this encoding into the specifiedWriter
. -
Uses of J2ktIncompatible in com.google.common.math
Classes in com.google.common.math with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionclass
A class for arithmetic onBigDecimal
that is not covered by its built-in methods.class
The representation of a linear transformation between real numbersx
andy
.final class
An immutable value object capturing some basic statistics about a collection of paired double values (e.g.final class
A mutable object which accumulates paired double values (e.g.final class
Provides a fluent API for calculating quantiles.final class
A bundle of statistical summary values -- sum, count, mean/average, min and max, and several forms of variance -- that were computed from a single set of zero or more floating-point values.final class
A mutable object which accumulates double values and tracks some basic statistics over all the values added so far.Methods in com.google.common.math with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionstatic long
LongMath.checkedPow
(long b, int k) Returns theb
to thek
th power, provided it does not overflow.static long
LongMath.checkedSubtract
(long a, long b) Returns the difference ofa
andb
, provided it does not overflow.static BigInteger
BigIntegerMath.divide
(BigInteger p, BigInteger q, RoundingMode mode) Returns the result of dividingp
byq
, rounding using the specifiedRoundingMode
.static long
LongMath.divide
(long p, long q, RoundingMode mode) Returns the result of dividingp
byq
, rounding using the specifiedRoundingMode
.static long
LongMath.factorial
(int n) Returnsn!
, that is, the product of the firstn
positive integers,1
ifn == 0
, orLong.MAX_VALUE
if the result does not fit in along
.static boolean
DoubleMath.isPowerOfTwo
(double x) Returnstrue
ifx
is exactly equal to2^k
for some finite integerk
.static boolean
IntMath.isPrime
(int n) Returnstrue
ifn
is a prime number: an integer greater than one that cannot be factored into a product of smaller positive integers.static boolean
LongMath.isPrime
(long n) Returnstrue
ifn
is a prime number: an integer greater than one that cannot be factored into a product of smaller positive integers.static int
BigIntegerMath.log10
(BigInteger x, RoundingMode mode) Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
IntMath.log10
(int x, RoundingMode mode) Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
LongMath.log10
(long x, RoundingMode mode) Returns the base-10 logarithm ofx
, rounded according to the specified rounding mode.static int
DoubleMath.log2
(double x, RoundingMode mode) Returns the base 2 logarithm of a double value, rounded with the specified rounding mode to anint
.static double
DoubleMath.mean
(double... values) Deprecated.UseStats.meanOf(java.lang.Iterable<? extends java.lang.Number>)
instead, noting the less strict handling of non-finite values.static double
Deprecated.UseStats.meanOf(java.lang.Iterable<? extends java.lang.Number>)
instead, noting the less strict handling of non-finite values.static double
Deprecated.UseStats.meanOf(java.lang.Iterable<? extends java.lang.Number>)
instead, noting the less strict handling of non-finite values.static int
LongMath.mod
(long x, int m) Returnsx mod m
, a non-negative value less thanm
.static long
LongMath.mod
(long x, long m) Returnsx mod m
, a non-negative value less thanm
.static int
IntMath.pow
(int b, int k) Returnsb
to thek
th power.static long
LongMath.pow
(long b, int k) Returnsb
to thek
th power.static BigInteger
DoubleMath.roundToBigInteger
(double x, RoundingMode mode) Returns theBigInteger
value that is equal tox
rounded with the specified rounding mode, if possible.static double
BigIntegerMath.roundToDouble
(BigInteger x, RoundingMode mode) Returnsx
, rounded to adouble
with the specified rounding mode.static double
LongMath.roundToDouble
(long x, RoundingMode mode) Returnsx
, rounded to adouble
with the specified rounding mode.static int
DoubleMath.roundToInt
(double x, RoundingMode mode) Returns theint
value that is equal tox
rounded with the specified rounding mode, if possible.static long
DoubleMath.roundToLong
(double x, RoundingMode mode) Returns thelong
value that is equal tox
rounded with the specified rounding mode, if possible.static BigInteger
BigIntegerMath.sqrt
(BigInteger x, RoundingMode mode) Returns the square root ofx
, rounded with the specified rounding mode.static long
LongMath.sqrt
(long x, RoundingMode mode) Returns the square root ofx
, rounded with the specified rounding mode. -
Uses of J2ktIncompatible in com.google.common.net
Classes in com.google.common.net with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionfinal class
A syntactically valid host specifier, suitable for use in a URI.final class
Static utility methods pertaining toInetAddress
instances. -
Uses of J2ktIncompatible in com.google.common.primitives
Classes in com.google.common.primitives with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionfinal class
Static utility methods pertaining tobyte
primitives that interpret values as unsigned (that is, any negative valueb
is treated as the positive value256 + b
).Methods in com.google.common.primitives with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionUnsignedInteger.times
(UnsignedInteger val) Returns the result of multiplying this andval
.static Double
Parses the specified string as a double-precision floating point value.static Float
Parses the specified string as a single-precision floating point value. -
Uses of J2ktIncompatible in com.google.common.util.concurrent
Classes in com.google.common.util.concurrent with annotations of type J2ktIncompatibleModifier and TypeClassDescriptionclass
Base class for services that can implementAbstractExecutionThreadService.startUp()
,AbstractExecutionThreadService.run()
andAbstractExecutionThreadService.shutDown()
methods.class
Base class for services that do not need a thread while "running" but may need one during startup and shutdown.class
AbstractListeningExecutorService
implementation that createsListenableFuture
instances for eachRunnable
andCallable
submitted to it.class
Base class for services that can implementAbstractScheduledService.startUp()
andAbstractScheduledService.shutDown()
but while in the "running" state need to perform a periodic task.class
Base class for implementing services that can handleAbstractService.doStart()
andAbstractService.doStop()
requests, responding to them withAbstractService.notifyStarted()
andAbstractService.notifyStopped()
callbacks.class
Adouble
value that may be updated atomically.class
Adouble
array in which elements may be updated atomically.final class
A map containinglong
values that can be atomically updated.final class
ClosingFuture<V extends @Nullable Object>
A step in a pipeline of an asynchronous computation.class
TheCycleDetectingLockFactory
createsReentrantLock
instances andReentrantReadWriteLock
instances that detect potential deadlock by checking for cycles in lock acquisition order.final class
A support class forListenableFuture
implementations to manage their listeners.final class
Serializes execution of tasks, somewhat like an "asynchronoussynchronized
block." Each enqueued callable will not be submitted to its associated executor until the previous callable has returned -- and, if the previous callable was anAsyncCallable
, not until theFuture
it returned is done (successful, failed, or cancelled).final class
A TimeLimiter implementation which actually does not attempt to limit time at all.class
ABlockingDeque
which forwards all its method calls to anotherBlockingDeque
.class
ABlockingQueue
which forwards all its method calls to anotherBlockingQueue
.class
An executor service which forwards all its method calls to another executor service.class
A listening executor service which forwards all its method calls to another listening executor service.final class
Utilities necessary for working with libraries that supply plainFuture
instances.class
ListenableFutureTask<V extends @Nullable Object>
AFutureTask
that also implements theListenableFuture
interface.interface
AScheduledExecutorService
that returnsListenableFuture
instances from itsExecutorService
methods.final class
A synchronization abstraction supporting waiting on arbitrary boolean conditions.class
A rate limiter.interface
An object with an operational state, plus asynchronousService.startAsync()
andService.stopAsync()
lifecycle methods to transition between states.final class
A manager for monitoring and controlling a set of services.final class
A TimeLimiter that runs method calls in the background using anExecutorService
.class
Striped<L>
A stripedLock/Semaphore/ReadWriteLock
.final class
A ThreadFactory builder, providing any combination of these features: whether threads should be marked as daemon threads a naming format a thread priority an uncaught exception handler a backing thread factoryinterface
Imposes a time limit on method calls.final class
Factories forThread.UncaughtExceptionHandler
instances.class
Unchecked version ofTimeoutException
.Methods in com.google.common.util.concurrent with annotations of type J2ktIncompatibleModifier and TypeMethodDescriptionstatic void
MoreExecutors.addDelayedShutdownHook
(ExecutorService service, long terminationTimeout, TimeUnit timeUnit) Add a shutdown hook to wait for thread completion in the givenservice
.static void
MoreExecutors.addDelayedShutdownHook
(ExecutorService service, Duration terminationTimeout) Add a shutdown hook to wait for thread completion in the givenservice
.static <T extends @Nullable Object>
AsyncCallable<T> Callables.asAsyncCallable
(Callable<T> callable, ListeningExecutorService listeningExecutorService) Creates anAsyncCallable
from aCallable
.static void
Uninterruptibles.awaitTerminationUninterruptibly
(ExecutorService executor) Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly with no timeout.static boolean
Uninterruptibles.awaitTerminationUninterruptibly
(ExecutorService executor, long timeout, TimeUnit unit) Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly.static boolean
Uninterruptibles.awaitTerminationUninterruptibly
(ExecutorService executor, Duration timeout) Invokesexecutor.
awaitTermination(long, TimeUnit)
uninterruptibly.static void
Uninterruptibles.awaitUninterruptibly
(CountDownLatch latch) Invokeslatch.
await()
uninterruptibly.static boolean
Uninterruptibles.awaitUninterruptibly
(CountDownLatch latch, long timeout, TimeUnit unit) Invokeslatch.
await(timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.awaitUninterruptibly
(CountDownLatch latch, Duration timeout) Invokeslatch.
await(timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.awaitUninterruptibly
(Condition condition, long timeout, TimeUnit unit) Invokescondition.
await(timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.awaitUninterruptibly
(Condition condition, Duration timeout) Invokescondition.
await(timeout, unit)
uninterruptibly.final <X extends Throwable>
FluentFuture<V> FluentFuture.catching
(Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from thisFuture
or, if thisFuture
fails with the givenexceptionType
, from the result provided by thefallback
.static <V extends @Nullable Object,
X extends Throwable>
ListenableFuture<V> Futures.catching
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.final <X extends Throwable>
FluentFuture<V> FluentFuture.catchingAsync
(Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from thisFuture
or, if thisFuture
fails with the givenexceptionType
, from the result provided by thefallback
.static <V extends @Nullable Object,
X extends Throwable>
ListenableFuture<V> Futures.catchingAsync
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.Futures.getChecked
(Future<V> future, Class<X> exceptionClass) Returns the result ofFuture.get()
, converting most exceptions to a new instance of the given checked exception type.Futures.getChecked
(Future<V> future, Class<X> exceptionClass, long timeout, TimeUnit unit) Returns the result ofFuture.get(long, TimeUnit)
, converting most exceptions to a new instance of the given checked exception type.Futures.getChecked
(Future<V> future, Class<X> exceptionClass, Duration timeout) Returns the result ofFuture.get(long, TimeUnit)
, converting most exceptions to a new instance of the given checked exception type.static ExecutorService
MoreExecutors.getExitingExecutorService
(ThreadPoolExecutor executor) Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ExecutorService
MoreExecutors.getExitingExecutorService
(ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ExecutorService
MoreExecutors.getExitingExecutorService
(ThreadPoolExecutor executor, Duration terminationTimeout) Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors.getExitingScheduledExecutorService
(ScheduledThreadPoolExecutor executor) Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors.getExitingScheduledExecutorService
(ScheduledThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static ScheduledExecutorService
MoreExecutors.getExitingScheduledExecutorService
(ScheduledThreadPoolExecutor executor, Duration terminationTimeout) Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete.static <V extends @Nullable Object>
VUninterruptibles.getUninterruptibly
(Future<V> future, long timeout, TimeUnit unit) Invokesfuture.
get(timeout, unit)
uninterruptibly.static <V extends @Nullable Object>
VUninterruptibles.getUninterruptibly
(Future<V> future, Duration timeout) Invokesfuture.
get(timeout, unit)
uninterruptibly.static void
Uninterruptibles.joinUninterruptibly
(Thread toJoin) InvokestoJoin.
join()
uninterruptibly.static void
Uninterruptibles.joinUninterruptibly
(Thread toJoin, long timeout, TimeUnit unit) Invokesunit.
timedJoin(toJoin, timeout)
uninterruptibly.static void
Uninterruptibles.joinUninterruptibly
(Thread toJoin, Duration timeout) Invokesunit.
timedJoin(toJoin, timeout)
uninterruptibly.Futures.lazyTransform
(Future<I> input, Function<? super I, ? extends O> function) LikeFutures.transform(ListenableFuture, Function, Executor)
except that the transformationfunction
is invoked on each call toget()
on the returned future.static ListeningExecutorService
MoreExecutors.listeningDecorator
(ExecutorService delegate) Creates anExecutorService
whosesubmit
andinvokeAll
methods submitListenableFutureTask
instances to the given delegate executor.MoreExecutors.listeningDecorator
(ScheduledExecutorService delegate) Creates aScheduledExecutorService
whosesubmit
andinvokeAll
methods submitListenableFutureTask
instances to the given delegate executor.static ListeningExecutorService
MoreExecutors.newDirectExecutorService()
Creates an executor service that runs each task in the thread that invokesexecute/submit
, as inThreadPoolExecutor.CallerRunsPolicy
.static Executor
MoreExecutors.newSequentialExecutor
(Executor delegate) Returns anExecutor
that runs each task executed sequentially, such that no two tasks are running concurrently.static ThreadFactory
MoreExecutors.platformThreadFactory()
Returns a default thread factory used to create new threads.static <E> void
Uninterruptibles.putUninterruptibly
(BlockingQueue<E> queue, E element) Invokesqueue.
put(element)
uninterruptibly.static <O extends @Nullable Object>
ListenableFuture<O> Futures.scheduleAsync
(AsyncCallable<O> callable, long delay, TimeUnit timeUnit, ScheduledExecutorService executorService) Schedulescallable
on the specifiedexecutor
, returning aFuture
.static <O extends @Nullable Object>
ListenableFuture<O> Futures.scheduleAsync
(AsyncCallable<O> callable, Duration delay, ScheduledExecutorService executorService) Schedulescallable
on the specifiedexecutor
, returning aFuture
.static boolean
MoreExecutors.shutdownAndAwaitTermination
(ExecutorService service, long timeout, TimeUnit unit) Shuts down the given executor service gradually, first disabling new submissions and later, if necessary, cancelling remaining tasks.static boolean
MoreExecutors.shutdownAndAwaitTermination
(ExecutorService service, Duration timeout) Shuts down the given executor service gradually, first disabling new submissions and later, if necessary, cancelling remaining tasks.static void
Uninterruptibles.sleepUninterruptibly
(long sleepFor, TimeUnit unit) Invokesunit.
sleep(sleepFor)
uninterruptibly.static void
Uninterruptibles.sleepUninterruptibly
(Duration sleepFor) Invokesunit.
sleep(sleepFor)
uninterruptibly.static <E> E
Uninterruptibles.takeUninterruptibly
(BlockingQueue<E> queue) Invokesqueue.
take()
uninterruptibly.static boolean
Uninterruptibles.tryAcquireUninterruptibly
(Semaphore semaphore, int permits, long timeout, TimeUnit unit) Invokessemaphore.
tryAcquire(permits, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.tryAcquireUninterruptibly
(Semaphore semaphore, int permits, Duration timeout) Invokessemaphore.
tryAcquire(permits, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.tryAcquireUninterruptibly
(Semaphore semaphore, long timeout, TimeUnit unit) Invokessemaphore.
tryAcquire(1, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.tryAcquireUninterruptibly
(Semaphore semaphore, Duration timeout) Invokessemaphore.
tryAcquire(1, timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.tryLockUninterruptibly
(Lock lock, long timeout, TimeUnit unit) Invokeslock.
tryLock(timeout, unit)
uninterruptibly.static boolean
Uninterruptibles.tryLockUninterruptibly
(Lock lock, Duration timeout) Invokeslock.
tryLock(timeout, unit)
uninterruptibly.final FluentFuture
<V> FluentFuture.withTimeout
(long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to this future but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified timeout expires.final FluentFuture
<V> FluentFuture.withTimeout
(Duration timeout, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to this future but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified timeout expires.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, Duration time, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.
Throwable.getStackTrace()
on JDK versions past JDK 8 and on all Android versions.