java.lang.Object
org.tquadrat.foundation.stream.Selectors
@UtilityClass
@ClassVersion(sourceVersion="$Id: Selectors.java 1031 2022-04-07 22:43:02Z tquadrat $")
public final class Selectors
extends Object
Some useful implementations of the
Selector
interface.- Author:
- Dominic Fox
- Modified by:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: Selectors.java 1031 2022-04-07 22:43:02Z tquadrat $
- Since:
- 0.0.7
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.stream.Selectors"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Selector<T> Returns a "Round Robin"Selectorimplementation.static <T extends Comparable<T>>
Selector<T> takeMax()Returns aSelectorimplementation that will always return the index for the greatest value from the given array, based on the natural order of the values.static <T> Selector<T> takeMax(Comparator<? super T> comparator) Returns aSelectorimplementation that will always return the index for the greatest value from the given array, imposed by the given comparator.static <T extends Comparable<T>>
Selector<T> takeMin()Returns aSelectorimplementation that will always return the index for the smallest value from the given array, based on the natural order of the values.static <T> Selector<T> takeMin(Comparator<? super T> comparator) Returns aSelectorimplementation that will always return the index for the smallest value from the given array, imposed by the given comparator.
-
Constructor Details
-
Selectors
private Selectors()No instance allowed for this class!
-
-
Method Details
-
roundRobin
Returns a "Round Robin"Selectorimplementation. It will return always the next index for the given array where the respective value is notnull, ornullif the array contains onlynullvalues.- Type Parameters:
T- The type of the values to select from.- Returns:
- The selector.
-
takeMax
Returns aSelectorimplementation that will always return the index for the greatest value from the given array, based on the natural order of the values.- Type Parameters:
T- The type of the values to select from.- Returns:
- The selector.
-
takeMax
@API(status=STABLE, since="0.0.7") public static <T> Selector<T> takeMax(Comparator<? super T> comparator) Returns aSelectorimplementation that will always return the index for the greatest value from the given array, imposed by the given comparator.- Type Parameters:
T- The type of the values to select from.- Parameters:
comparator- The comparator.- Returns:
- The selector.
-
takeMin
Returns aSelectorimplementation that will always return the index for the smallest value from the given array, based on the natural order of the values.- Type Parameters:
T- The type of the values to select from.- Returns:
- The selector.
-
takeMin
@API(status=STABLE, since="0.0.7") public static <T> Selector<T> takeMin(Comparator<? super T> comparator) Returns aSelectorimplementation that will always return the index for the smallest value from the given array, imposed by the given comparator.- Type Parameters:
T- The type of the values to select from.- Parameters:
comparator- The comparator.- Returns:
- The selector.
-
