Skip to content

Commit

Permalink
Изменение интерфейса Supplier
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloogefest committed Dec 13, 2024
1 parent 31d6e21 commit db98655
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,27 @@ public interface Supplier<T, F extends Throwable> {
* @since 1.0.0-RC1
*/
@Contract("? -> new")
static <T, F extends Throwable> @NonNull Supplier<T, F> of(final @Nullable T object) {
static <T, F extends Throwable> @NonNull Supplier<T, F> direct(final @Nullable T object) {
return () -> object;
}

/**
* Возвращает [1].
*
* @param supplier поставщик (1) объектов (2).
* @param <T> тип [2].
* @param <F> тип программного сбоя или неисправности, возникающей при неудачной поставке [2].
*
* @return [1].
*
* @apiNote Предназначен для удобного создания [1] на основе лямбда-выражений.
* @since 1.0.0-RC1
*/
@Contract("? -> 1")
static <T, F extends Throwable> @NonNull Supplier<T, F> of(final @NonNull Supplier<T, F> supplier) {
return supplier;
}

/**
* Поставляет объект (1).
*
Expand Down

0 comments on commit db98655

Please sign in to comment.