Package pro.horde.os.cutils.function
Class Idler<T>
- java.lang.Object
-
- pro.horde.os.cutils.function.Idler<T>
-
- Type Parameters:
T- the type value
- All Implemented Interfaces:
Serializable,Supplier<T>,Dealer<T>
public final class Idler<T> extends Object implements Supplier<T>, Dealer<T>, Serializable
TheIdlerr 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:
- 5.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 Tdeal()Gets a result for dealer operation.static <T> Dealer<T>deal(Dealer<? extends T> dealer)Supply take an instance ofDealeras parameter..booleanequals(Object o)Tget()Gets a result for supplier operation.inthashCode()static <T> Idler<T>of(Supplier<? extends T> supplier, Dealer<? extends T> dealer)static <T> Idler<T>of(Dealer<? extends T> dealer, Supplier<T> supplier)static <T> Supplier<T>supply(Supplier<? extends T> supplier)Supply take an instance ofSupplieras parameter..
-
-
-
Method Detail
-
supply
public static <T> Supplier<T> supply(Supplier<? extends T> supplier)
Supply take an instance ofSupplieras parameter..
-
deal
public static <T> Dealer<T> deal(Dealer<? extends T> dealer)
Supply take an instance ofDealeras parameter..
-
deal
public T deal() throws Exception
Gets a result for dealer operation.- Specified by:
dealin 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:
getin interfaceSupplier<T>- Returns:
- a supplier result
- See Also:
Supplier.get()
-
-