style(commons): Clean up Throwable*.of
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Johannes Frohnmeyer 2024-05-04 22:01:56 +02:00
parent 0e15fe3abd
commit e1d6f578a8
Signed by: Johannes
GPG Key ID: E76429612C2929F4
8 changed files with 8 additions and 16 deletions

View File

@ -9,8 +9,7 @@ import java.util.function.*;
@FunctionalInterface
public interface ThrowingBiConsumer<T, U, TEx extends Throwable> {
static <T, U, TEx extends Throwable> @NotNull ThrowingBiConsumer<T, U, TEx> of(@NotNull BiConsumer<T, U> consumer) {
Objects.requireNonNull(consumer);
return consumer::accept;
return Objects.requireNonNull(consumer)::accept;
}
void accept(T var1, U var2) throws TEx;

View File

@ -10,8 +10,7 @@ import java.util.function.Function;
@FunctionalInterface
public interface ThrowingBiFunction<T, U, R, TEx extends Throwable> {
static <T, U, R, TEx extends Throwable> @NotNull ThrowingBiFunction<T, U, R, TEx> of(@NotNull BiFunction<T, U, R> function) {
Objects.requireNonNull(function);
return function::apply;
return Objects.requireNonNull(function)::apply;
}
R apply(T var1, U var2) throws TEx;

View File

@ -8,8 +8,7 @@ import java.util.function.*;
@FunctionalInterface
public interface ThrowingBooleanSupplier<TEx extends Throwable> {
static <TEx extends Throwable> @NotNull ThrowingBooleanSupplier<TEx> of(@NotNull BooleanSupplier supplier) {
Objects.requireNonNull(supplier);
return supplier::getAsBoolean;
return Objects.requireNonNull(supplier)::getAsBoolean;
}
boolean get() throws TEx;

View File

@ -9,8 +9,7 @@ import java.util.function.Function;
@FunctionalInterface
public interface ThrowingConsumer<T, TEx extends Throwable> {
static <T> @NotNull ThrowingConsumer<T, RuntimeException> of(@NotNull Consumer<T> consumer) {
Objects.requireNonNull(consumer);
return consumer::accept;
return Objects.requireNonNull(consumer)::accept;
}
void accept(T var1) throws TEx;

View File

@ -8,8 +8,7 @@ import java.util.function.Function;
@FunctionalInterface
public interface ThrowingFunction<T, R, TEx extends Throwable> {
static <T, R> @NotNull ThrowingFunction<T, R, RuntimeException> of(@NotNull Function<T, R> function) {
Objects.requireNonNull(function);
return function::apply;
return Objects.requireNonNull(function)::apply;
}
R apply(T var1) throws TEx;

View File

@ -9,8 +9,7 @@ import java.util.function.Predicate;
@FunctionalInterface
public interface ThrowingPredicate<T, TEx extends Throwable> {
static <T> @NotNull ThrowingPredicate<T, RuntimeException> of(@NotNull Predicate<T> predicate) {
Objects.requireNonNull(predicate);
return predicate::test;
return Objects.requireNonNull(predicate)::test;
}
boolean test(T var1) throws TEx;

View File

@ -9,8 +9,7 @@ import java.util.function.Function;
@FunctionalInterface
public interface ThrowingRunnable<TEx extends Throwable> {
static @NotNull ThrowingRunnable<RuntimeException> of(@NotNull Runnable runnable) {
Objects.requireNonNull(runnable);
return runnable::run;
return Objects.requireNonNull(runnable)::run;
}
void run() throws TEx;

View File

@ -9,8 +9,7 @@ import java.util.function.Supplier;
@FunctionalInterface
public interface ThrowingSupplier<T, TEx extends Throwable> {
static <T> @NotNull ThrowingSupplier<T, RuntimeException> of(@NotNull Supplier<T> supplier) {
Objects.requireNonNull(supplier);
return supplier::get;
return Objects.requireNonNull(supplier)::get;
}
T get() throws TEx;