Package art.cutils.function
Class Idler<T>
- java.lang.Object
-
- art.cutils.function.Idler<T>
-
- Type Parameters:
T
- the type value
- All Implemented Interfaces:
Dealer<T>
,Serializable
,Supplier<T>
public final class Idler<T> extends Object implements Supplier<T>, Dealer<T>, Serializable
TheIdler
r is intended to be memorized and idempotent. This can be very useful for operations with high latency whose result are used multitudinous. The operation is performed once and the result and served whenever needed and hence improving the performance.- Since:
- 1.0
- Author:
- , Bobai Kato
- See Also:
Supplier
,Dealer
, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deal()
Gets a result for dealer operation.static <T> @NotNull Dealer<T>
deal(Dealer<? extends T> dealer)
Supply take an instance ofDealer
as parameter..boolean
equals(Object o)
T
get()
Gets a result for supplier operation.int
hashCode()
static <T> @NotNull Idler<T>
of(Dealer<? extends T> dealer, Supplier<T> supplier)
static <T> @NotNull Idler<T>
of(Supplier<? extends T> supplier, Dealer<? extends T> dealer)
static <T> @NotNull Supplier<T>
supply(Supplier<? extends T> supplier)
Supply take an instance ofSupplier
as parameter..
-
-
-
Method Detail
-
of
@Contract("_, _ -> new") @NotNull public static <T> @NotNull Idler<T> of(Dealer<? extends T> dealer, Supplier<T> supplier)
-
of
@Contract("_, _ -> new") @NotNull public static <T> @NotNull Idler<T> of(Supplier<? extends T> supplier, Dealer<? extends T> dealer)
-
supply
@Contract("_ -> new") @NotNull public static <T> @NotNull Supplier<T> supply(Supplier<? extends T> supplier)
Supply take an instance ofSupplier
as parameter..
-
deal
@Contract("_ -> new") @NotNull public static <T> @NotNull Dealer<T> deal(Dealer<? extends T> dealer)
Supply take an instance ofDealer
as parameter..
-
deal
public T deal() throws Exception
Gets a result for dealer operation.- Specified by:
deal
in interfaceDealer<T>
- Returns:
- a dealer result
- Throws:
Exception
- operation exception thrown- See Also:
Dealer.deal()
-
get
public T get()
Gets a result for supplier operation.- Specified by:
get
in interfaceSupplier<T>
- Returns:
- a supplier result
- See Also:
Supplier.get()
-
-