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"

UML Diagram for "org.tquadrat.foundation.stream.Selectors"

UML Diagram for "org.tquadrat.foundation.stream.Selectors"
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    No instance allowed for this class!
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Selector<T>
    Returns a "Round Robin" Selector implementation.
    static <T extends Comparable<T>>
    Selector<T>
    Returns a Selector implementation 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 a Selector implementation 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>
    Returns a Selector implementation 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 a Selector implementation that will always return the index for the smallest value from the given array, imposed by the given comparator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Selectors

      private Selectors()
      No instance allowed for this class!
  • Method Details

    • roundRobin

      @API(status=STABLE, since="0.0.7") public static <T> Selector<T> roundRobin()
      Returns a "Round Robin" Selector implementation. It will return always the next index for the given array where the respective value is not null, or null if the array contains only null 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 extends Comparable<T>> Selector<T> takeMax()
      Returns a Selector implementation 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 a Selector implementation 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

      @API(status=STABLE, since="0.0.7") public static <T extends Comparable<T>> Selector<T> takeMin()
      Returns a Selector implementation 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 a Selector implementation 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.