public class FloatAsyncBuilder
extends java.lang.Object
public void processFiles(ObjectCollection<String> potentialFiles) {
potentialFiles.asAsync()
.map(Paths::get).filter(Files::exists) //Modifies the collection (Optional)
.forEach(Files::delete) //Creates the action (Required)
.onCompletion(T -> {}} //Callback on completion (Optional)
.execute() //Starts the task. (Required)
}
| Modifier and Type | Class and Description |
|---|---|
static class |
FloatAsyncBuilder.BaseFloatTask
Base Task of the Actions that can be performed.
|
| Constructor and Description |
|---|
FloatAsyncBuilder(FloatAsyncBuilder.BaseFloatTask task)
Helper constructor.
|
FloatAsyncBuilder(FloatIterable iterable)
Main Constructor that uses a Iterable to build a Offthread Task.
|
| Modifier and Type | Method and Description |
|---|---|
<E> ObjectAsyncBuilder<E> |
arrayflatMap(FloatFunction<E[]> mapper)
Maps the elements to something else
|
IntAsyncBuilder |
count(FloatPredicate filter)
Counts all desired elements inside the Iterable
|
FloatAsyncBuilder |
distinct()
Removes duplicated elements out of the Iterable
|
FloatTask |
execute()
Starts the Execution of the task without awaiting its result
|
FloatAsyncBuilder |
executor(java.util.concurrent.Executor executor)
Optional way to add a custom executor that runs this offthread task.
|
FloatAsyncBuilder |
filter(FloatPredicate filter)
Filters out the unwanted elements out of the Iterable
|
FloatAsyncBuilder |
findFirst(FloatPredicate filter)
Searches through the elements of the Iterable to find if the desired element.
|
<E,V extends java.lang.Iterable<E>> |
flatMap(FloatFunction<V> mapper)
Maps the elements to something else
|
ObjectAsyncBuilder<java.lang.Void> |
forEach(FloatConsumer action)
Iterates over the Iterable with a desired action
|
float |
join()
Starts the Execution of the task and will await its completion, returning the result.
|
float |
join(long timeout,
java.util.concurrent.TimeUnit unit)
Starts the Execution of the task and will await its completion with a timeout, returning the result.
|
FloatAsyncBuilder |
limit(long limit)
Limits how many elements are inside of the Iterable
|
<E> ObjectAsyncBuilder<E> |
map(FloatFunction<E> mapper)
Maps the elements to something else
|
BooleanAsyncBuilder |
matchAll(FloatPredicate filter)
Searches through the elements of the Iterable to find if all the desired elements are present.
|
BooleanAsyncBuilder |
matchAny(FloatPredicate filter)
Searches through the elements of the Iterable to find if the desired element is present.
|
BooleanAsyncBuilder |
matchNone(FloatPredicate filter)
Searches through the elements of the Iterable to find if unwanted elements are present.
|
static FloatAsyncBuilder |
of(float... values)
Helper function that automatically wraps a array into a AsyncBuilder since it forces this collections Iterable.
|
static FloatAsyncBuilder |
of(java.lang.Iterable<java.lang.Float> iterable)
Helper function that automatically wraps a Iterable into a AsyncBuilder since it forces this collections Iterable.
|
FloatAsyncBuilder |
onCompletion(java.util.function.Consumer<FloatTask> callback)
Optional way to set a callback that allows to compute actions after the task was completed.
|
FloatAsyncBuilder |
peek(FloatConsumer action)
Allows to preview elements before they are processed
|
<E extends FloatCollection> |
pour(E collection)
Pours all elements into a collection that can be later
|
ObjectAsyncBuilder<FloatList> |
pourAsList()
Pours all elements into a List that can be later
|
ObjectAsyncBuilder<FloatSet> |
pourAsSet()
Pours all elements into a Set that can be later
|
FloatAsyncBuilder |
reduce(float identity,
FloatFloatUnaryOperator operator)
Reduces the elements inside of the Iterable down to one element using a identity element.
|
FloatAsyncBuilder |
reduce(FloatFloatUnaryOperator operator)
Reduces the elements inside of the Iterable down to one element
|
FloatAsyncBuilder |
repeat(int repeats)
Repeats the elements inside of the Iterable
|
FloatAsyncBuilder |
sorted(FloatComparator sorter)
Sorts the elements inside of the Iterable.
|
ObjectAsyncBuilder<float[]> |
toFloatArray()
Pours all elements of the Iterable down into a Array.
|
public FloatAsyncBuilder(FloatIterable iterable)
iterable - that should be processedpublic FloatAsyncBuilder(FloatAsyncBuilder.BaseFloatTask task)
task - that had been buildpublic static FloatAsyncBuilder of(java.lang.Iterable<java.lang.Float> iterable)
iterable - that should be wrappedpublic static FloatAsyncBuilder of(float... values)
values - that should be wrappedpublic <E> ObjectAsyncBuilder<E> map(FloatFunction<E> mapper)
E - The return type.mapper - the mapping functionpublic <E,V extends java.lang.Iterable<E>> ObjectAsyncBuilder<E> flatMap(FloatFunction<V> mapper)
V - The return type supplier.E - The return type.mapper - the flatMapping functionpublic <E> ObjectAsyncBuilder<E> arrayflatMap(FloatFunction<E[]> mapper)
E - The return type.mapper - the flatMapping functionpublic FloatAsyncBuilder filter(FloatPredicate filter)
filter - the elements that should be keptpublic FloatAsyncBuilder distinct()
public FloatAsyncBuilder repeat(int repeats)
repeats - the amount of times the elements should be repeatedpublic FloatAsyncBuilder limit(long limit)
limit - how many elements should max be iterated throughpublic FloatAsyncBuilder sorted(FloatComparator sorter)
sorter - that sorts the elements.public FloatAsyncBuilder peek(FloatConsumer action)
action - the action that should be appliedpublic ObjectAsyncBuilder<java.lang.Void> forEach(FloatConsumer action)
action - that should be appliedpublic FloatAsyncBuilder reduce(FloatFloatUnaryOperator operator)
operator - that reduces the elements.public FloatAsyncBuilder reduce(float identity, FloatFloatUnaryOperator operator)
identity - the element the reduce function should start withoperator - that reduces the elements.public ObjectAsyncBuilder<float[]> toFloatArray()
public ObjectAsyncBuilder<FloatList> pourAsList()
public ObjectAsyncBuilder<FloatSet> pourAsSet()
public <E extends FloatCollection> ObjectAsyncBuilder<E> pour(E collection)
E - the return typecollection - the collection the elementspublic BooleanAsyncBuilder matchAny(FloatPredicate filter)
filter - that decides the desired elementspublic BooleanAsyncBuilder matchNone(FloatPredicate filter)
filter - that decides the unwanted elementspublic BooleanAsyncBuilder matchAll(FloatPredicate filter)
filter - that decides the desired elementspublic FloatAsyncBuilder findFirst(FloatPredicate filter)
filter - that decides the desired elementspublic IntAsyncBuilder count(FloatPredicate filter)
filter - that decides the desired elementspublic FloatAsyncBuilder executor(java.util.concurrent.Executor executor)
executor - that executes the task, defaults to SanityChecks.invokeAsyncTask(Runnable)public FloatAsyncBuilder onCompletion(java.util.function.Consumer<FloatTask> callback)
callback - that should be notified after completion of the taskpublic FloatTask execute()
public float join()
throws java.util.concurrent.ExecutionException,
java.lang.InterruptedException
java.util.concurrent.ExecutionException - if the task threw a exceptionjava.lang.InterruptedException - if the caller thread was interruptedpublic float join(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
timeout - of how long the thread should wait the task to be completedunit - of the desired waiting time.java.lang.InterruptedException - if the caller thread was interruptedjava.util.concurrent.ExecutionException - if the task threw a exceptionjava.util.concurrent.TimeoutException - if the timeout was reached before the task was finished