类 SneakyUtils
java.lang.Object
committee.nova.mods.avaritia.api.util.SneakyUtils
SneakyUtils
-
嵌套类概要
嵌套类修饰符和类型类说明static classstatic interfaceSneakyUtils.ThrowingConsumer<T,E extends Throwable> static interfaceSneakyUtils.ThrowingFunction<T,R, E extends Throwable> static interfaceSneakyUtils.ThrowingRunnable<E extends Throwable>static interfaceSneakyUtils.ThrowingSupplier<T,E extends Throwable> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static RunnableConcatenates twoRunnables.static <T> Predicate<T>falseP()Returns a Predicate that always fails.static <T> BinaryOperator<T>first()A BinaryOperator which always resolves to the left-hand element.static <T> BinaryOperator<T>last()A BinaryOperator which always resolves to the right-hand element.static Runnablenone()Returns a Runnable that does nothing.Returns a Supplier for a NotPossibleException.static <T> Callable<T>nullC()Returns a Callable that always returns null when executed.static <T> Consumer<T>nullCons()Returns a Consumer that does nothing when executed.static <T> Supplier<T>nullS()Returns a Supplier that always returns null when executed.static <T> Consumer<T>sneak(SneakyUtils.ThrowingConsumer<T, Throwable> cons) Wraps a ThrowingConsumer to aConsumerRethrowing any exceptions produced by the ThrowingConsumer as unchecked(as seen by the compiler.)static <T,R> Function<T, R> sneak(SneakyUtils.ThrowingFunction<T, R, Throwable> tf) Wraps a ThrowingFunction to aFunctionRethrowing any exceptions produced by the ThrowingFunction as unchecked(as seen by the compiler.)static RunnableWraps a ThrowingRunnable to aRunnable.static <T> Supplier<T>Wraps a ThrowingSupplier to aSupplierRethrowing any exceptions produced by the ThrowingSupplier as unchecked(as seen by the compiler.)static voidExecutes the given ThrowingRunnable, rethrowing any exceptions produced by the runnable as Unchecked(as seen by the compiler.)static <T> TExecutes the given ThrowingRunnable, rethrowing any exceptions produced by the runnable as Unchecked(as seen by the compiler.)static <T extends Throwable>
voidThrows an exception without compiler warnings.static <T> Predicate<T>trueP()Returns a Predicate that always passes.static <T> TunsafeCast(@Nullable Object object)
-
构造器详细资料
-
SneakyUtils
public SneakyUtils()
-
-
方法详细资料
-
none
Returns a Runnable that does nothing.- 返回:
- The runnable.
-
nullC
Returns a Callable that always returns null when executed.- 返回:
- The callable.
-
nullS
Returns a Supplier that always returns null when executed.- 返回:
- The callable.
-
nullCons
Returns a Consumer that does nothing when executed.- 返回:
- The consumer.
-
trueP
Returns a Predicate that always passes.- 返回:
- The Predicate.
-
falseP
Returns a Predicate that always fails.- 返回:
- The Predicate.
-
first
A BinaryOperator which always resolves to the left-hand element.- 返回:
- The BinaryOperator.
-
last
A BinaryOperator which always resolves to the right-hand element.- 返回:
- The BinaryOperator.
-
concat
Concatenates twoRunnables. -
notPossible
Returns a Supplier for a NotPossibleException.Useful for Optional instance assertions.
- 返回:
- The Supplier.
-
sneaky
Executes the given ThrowingRunnable, rethrowing any exceptions produced by the runnable as Unchecked(as seen by the compiler.)- 参数:
tr- The ThrowingRunnable.
-
sneak
Wraps a ThrowingRunnable to aRunnable. Seesneaky(ThrowingRunnable)for info.- 参数:
tr- The ThrowingRunnable to wrap.- 返回:
- The wrapped runnable.
-
sneak
Wraps a ThrowingConsumer to aConsumerRethrowing any exceptions produced by the ThrowingConsumer as unchecked(as seen by the compiler.)- 参数:
cons- The ThrowingConsumer to wrap.- 返回:
- The wrapped Consumer.
-
sneaky
Executes the given ThrowingRunnable, rethrowing any exceptions produced by the runnable as Unchecked(as seen by the compiler.)- 参数:
sup- The ThrowingSupplier.- 返回:
- The return result of the ThrowingSupplier.
-
sneak
Wraps a ThrowingSupplier to aSupplierRethrowing any exceptions produced by the ThrowingSupplier as unchecked(as seen by the compiler.)- 参数:
sup- The ThrowingSupplier to wrap.- 返回:
- The wrapped Supplier.
-
sneak
Wraps a ThrowingFunction to aFunctionRethrowing any exceptions produced by the ThrowingFunction as unchecked(as seen by the compiler.)- 参数:
tf- The ThrowingFunction to wrap.- 返回:
- The wrapped Function.
-
unsafeCast
@Nullable @Contract("null->null;!null->!null") public static <T> T unsafeCast(@Nullable @Nullable Object object) -
throwUnchecked
Throws an exception without compiler warnings.- 抛出:
T extends Throwable
-