Package org.ojalgo.type.function
Interface AutoSupplier<T>
- All Superinterfaces:
AutoCloseable
,AutoFunctional
,Iterable<T>
,Supplier<T>
- All Known Subinterfaces:
FromFileReader<T>
- All Known Implementing Classes:
DataReader
,ManagedSupplier
,MappedSupplier
,QueuedSupplier
,SequencedSupplier
,TextLineReader
- 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 AutoSupplier<T>
extends AutoCloseable, Supplier<T>, AutoFunctional, Iterable<T>
Utilities for
AutoCloseable
Supplier
:s-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
default int
drainTo
(Collection<? super T> container, int maxElements) static <T> AutoSupplier
<T> empty()
default T
get()
iterator()
static <T> AutoSupplier
<T> Will create a JMX bean, with the given name, that keeps track of the supplier's throughput.static <T> AutoSupplier
<T> managed
(Throughput manager, Supplier<T> supplier) If you want that throughput manager to be registered as a JMX bean, that's up to you.static <T,
U> AutoSupplier <U> Get something and map/transform before returning itstatic <T,
U> AutoSupplier <U> Get something, that passes the test, and map/transform before returning itdefault void
processAll
(Consumer<T> processor) static <T> AutoSupplier
<T> queued
(ExecutorService executor, BlockingQueue<T> queue, Supplier<T>... suppliers) Multiple suppliers supply to a queue, then you get from that queue.read()
static <T> AutoSupplier
<T> sequenced
(BlockingQueue<? extends Supplier<T>> sources) static <S,
T> AutoSupplier <T> sequenced
(BlockingQueue<S> sources, Function<S, ? extends Supplier<T>> factory) Create anAutoSupplier
that will supply items from the containers, one after the other, until all containers are empty.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
empty
-
managed
Will create a JMX bean, with the given name, that keeps track of the supplier's throughput. -
managed
If you want that throughput manager to be registered as a JMX bean, that's up to you. -
mapped
Get something and map/transform before returning it -
mapped
static <T,U> AutoSupplier<U> mapped(Supplier<T> supplier, Predicate<T> filter, Function<T, U> mapper) Get something, that passes the test, and map/transform before returning it -
queued
static <T> AutoSupplier<T> queued(ExecutorService executor, BlockingQueue<T> queue, Supplier<T>... suppliers) Multiple suppliers supply to a queue, then you get from that queue. There will be 1 thread (executor task) per supplier. -
sequenced
-
sequenced
static <S,T> AutoSupplier<T> sequenced(BlockingQueue<S> sources, Function<S, ? extends Supplier<T>> factory) Create anAutoSupplier
that will supply items from the containers, one after the other, until all containers are empty. You can create multiple such suppliers sharing the same queue of containers.- Type Parameters:
S
- The type of some sort of item container (maybe aFile
)T
- The supplier item type (what do the files contain?)- Parameters:
sources
- A set of item containers (could be a set ofFile
:s)factory
- A factory method that can take one of the "containers" and return an item supplier.- Returns:
- A sequenced supplier.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
drainTo
-
get
-
iterator
-
processAll
-
read
T read()
-