Package zone.lamprey.function
Interface Supplier<T>
- Type Parameters:
T- the type of results supplied by this supplier
- All Superinterfaces:
Supplier<T>
- All Known Subinterfaces:
BooleanSupplier,DoubleSupplier,IntSupplier,LongSupplier
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Supplier<T> extends Supplier<T>
Represents a supplier of results.
There is no requirement that a new or distinct result be returned each time the supplier is invoked.
This is a functional interface whose
functional method is get().
- Since:
- 1.8
-
Method Summary
Modifier and Type Method Description default Runnableconsume(Consumer<T> consumer)Consume a supplier.Tget()Gets a result.default <R> Supplier<R>map(Function<T,R> functor)Lift a supplier.default DoubleSuppliermapToDouble(ToDoubleFunction<T> functor)Lift a supplier.default IntSuppliermapToInt(ToIntFunction<T> functor)Lift a supplier.default LongSuppliermapToLong(ToLongFunction<T> functor)Lift a supplier.default BooleanSupplierpredicate(Predicate<T> functor)Lift a supplier.
-
Method Details
-
get
T get()Gets a result. -
consume
Consume a supplier.- Parameters:
consumer- The consumer to use in consuming.- Returns:
- A Runnable which passes the result of this supplier into the given consumer when run.
-
predicate
Lift a supplier.- Parameters:
functor- The function to use in lifting.- Returns:
- A function that passes the result of fn through a functor to produce a lifted function.
-
map
Lift a supplier.- Type Parameters:
R- The new return type.- Parameters:
functor- The function to use in lifting.- Returns:
- A supplier that passes the result of fn through a functor to produce a lifted supplier.
-
mapToDouble
Lift a supplier.- Parameters:
functor- The function to use in lifting.- Returns:
- A function that passes the result of fn through a functor to produce a lifted function.
-
mapToInt
Lift a supplier.- Parameters:
functor- The function to use in lifting.- Returns:
- A function that passes the result of fn through a functor to produce a lifted function.
-
mapToLong
Lift a supplier.- Parameters:
functor- The function to use in lifting.- Returns:
- A function that passes the result of fn through a functor to produce a lifted function.
-