public final class LambdaUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> void |
applyToAllWhileSuppressingExceptions(Iterable<T> inputs,
ThrowingConsumer<T,? extends Exception> throwingConsumer)
This method supplies all elements from the input to the consumer.
|
static <R,E extends Throwable> |
withContextClassLoader(ClassLoader cl,
SupplierWithException<R,E> s)
Runs the given runnable with the given ClassLoader as the thread's
context class loader . |
static <E extends Throwable> |
withContextClassLoader(ClassLoader cl,
ThrowingRunnable<E> r)
Runs the given runnable with the given ClassLoader as the thread's
context class loader . |
public static <T> void applyToAllWhileSuppressingExceptions(Iterable<T> inputs, ThrowingConsumer<T,? extends Exception> throwingConsumer) throws Exception
T
- the type of input.inputs
- iterator for all inputs to the throwingConsumer.throwingConsumer
- this consumer will be called for all elements delivered by the input
iterator.Exception
- collected exceptions that happened during the invocation of the consumer on
the input elements.public static <E extends Throwable> void withContextClassLoader(ClassLoader cl, ThrowingRunnable<E> r) throws E extends Throwable
context class loader
.
The method will make sure to set the context class loader of the calling thread back to what it was before after the runnable completed.
E extends Throwable
public static <R,E extends Throwable> R withContextClassLoader(ClassLoader cl, SupplierWithException<R,E> s) throws E extends Throwable
context class loader
.
The method will make sure to set the context class loader of the calling thread back to what it was before after the runnable completed.
E extends Throwable
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.