| Modifier and Type | Method and Description |
|---|---|
static List<Throwable> |
Throwables.getCausalChain(Throwable throwable)
Gets a
Throwable cause chain as a list. |
static <X extends Throwable> |
Throwables.getCauseAs(Throwable throwable,
Class<X> expectedCauseType)
Returns
throwable's cause, cast to expectedCauseType. |
static List<StackTraceElement> |
Throwables.lazyStackTrace(Throwable throwable)
Returns the stack trace of
throwable, possibly providing slower iteration over the full
trace but faster iteration over parts of the trace. |
static boolean |
Throwables.lazyStackTraceIsLazy()
Returns whether
Throwables.lazyStackTrace(java.lang.Throwable) will use the special implementation described in its
documentation. |
| Modifier and Type | Method and Description |
|---|---|
static <E> ImmutableSet.Builder<E> |
ImmutableSet.builderWithExpectedSize(int expectedSize)
Returns a new builder, expecting the specified number of distinct elements to be added.
|
static <E> int |
Queues.drain(BlockingQueue<E> q,
Collection<? super E> buffer,
int numElements,
long timeout,
TimeUnit unit)
Drains the queue as
BlockingQueue.drainTo(Collection, int), but if the requested numElements 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.
|
default void |
Multiset.forEachEntry(java.util.function.ObjIntConsumer<? super E> action)
Runs the specified action for each distinct element in this multiset, and the number of
occurrences of that element.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
IntMath.ceilingPowerOfTwo(int x)
Returns the smallest power of two greater than or equal to
x. |
static int |
IntMath.floorPowerOfTwo(int x)
Returns the largest power of two less than or equal to
x. |
static int |
IntMath.saturatedAdd(int a,
int b)
Returns the sum of
a and b unless it would overflow or underflow in which case
Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedMultiply(int a,
int b)
Returns the product of
a and b unless it would overflow or underflow in which
case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedPow(int b,
int k)
Returns the
b to the kth power, unless it would overflow or underflow in which
case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
static int |
IntMath.saturatedSubtract(int a,
int b)
Returns the difference of
a and b unless it would overflow or underflow in
which case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. |
| Modifier and Type | Method and Description |
|---|---|
static int |
Ints.constrainToRange(int value,
int min,
int max)
Returns the value nearest to
value which is within the closed range [min..max]. |
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractListeningExecutorService
Abstract
ListeningExecutorService implementation that creates ListenableFuture
instances for each Runnable and Callable submitted to it. |
class |
FluentFuture<V>
A
ListenableFuture that supports fluent chains of operations. |
interface |
ListenableScheduledFuture<V>
Helper interface to implement both
ListenableFuture and ScheduledFuture. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
AbstractFuture.afterDone()
Callback method that is called exactly once after the future is completed.
|
static ThreadFactory |
MoreExecutors.platformThreadFactory()
Returns a default thread factory used to create new threads.
|
boolean |
SettableFuture.setFuture(ListenableFuture<? extends V> future) |
protected boolean |
AbstractFuture.setFuture(ListenableFuture<? extends V> future)
Sets the result of this
Future to match the supplied input Future once the
supplied Future is done, unless this Future has already been cancelled or set
(including "set asynchronously," defined below). |
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 <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function,
Executor executor)
Returns a new
Future whose result is derived from the result of the given Future. |
static <V> 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 a
TimeoutException wrapped in an ExecutionException) if the specified duration expires. |
Copyright © 2007-2022. All Rights Reserved.