Class RoundRobinValueSupplier<T>

java.lang.Object
guru.mikelue.foxglove.functional.RoundRobinValueSupplier<T>
Type Parameters:
T - The type of value supplied
All Implemented Interfaces:
StatefulSupplier<T>, Supplier<T>

public class RoundRobinValueSupplier<T> extends Object implements StatefulSupplier<T>
Supplies values in round-robin manner from the given list.
  • Method Details

    • of

      public static <T> RoundRobinValueSupplier<T> of(T... values)
      Constructs the supplier with at least two values.
      Type Parameters:
      T - The type of value supplied
      Parameters:
      values - The values to be supplied in round-robin manner
      Returns:
      The constructed supplier
      See Also:
    • of

      public static <T> RoundRobinValueSupplier<T> of(Stream<? extends T> values)
      Constructs the supplier with at least two values from the given stream.
      Type Parameters:
      T - The type of value supplied
      Parameters:
      values - The stream of values
      Returns:
      The constructed supplier
      See Also:
    • of

      public static <T> RoundRobinValueSupplier<T> of(List<? extends T> values)
      Constructs the supplier with at least two values from the given list.
      Type Parameters:
      T - The type of value supplied
      Parameters:
      values - The list of values
      Returns:
      The constructed supplier
      See Also:
    • get

      public T get()
      Specified by:
      get in interface Supplier<T>