Class Values<E extends Enum<E>>

java.lang.Object
de.team33.patterns.enums.pan.Values<E>
Type Parameters:
E - The enum type whose values should be handled.

public final class Values<E extends Enum<E>> extends Object
A Tool to handle enum values.
  • Method Details

    • of

      public static <E extends Enum<E>> Values<E> of(Class<E> enumClass)
      Returns a tool instance to handle the values of the given enum class.
    • stream

      public final Stream<E> stream()
      Returns a Stream over all values of the underlying enum type.
    • findAll

      public final Stream<E> findAll(Predicate<? super E> filter)
      Returns a Stream of those values of the underlying enum type that match the given filter.
    • findAny

      public final Optional<E> findAny(Predicate<? super E> filter)
      Returns an optional value of the associated enum type that matches the given filter or, if no such value exists, Optional.empty().
    • findAny

      public final E findAny(Predicate<? super E> filter, E fallback)
      Returns a value of the associated enum type that matches the given filter or, if no such value exists, the given fallback.
    • findFirst

      public final Optional<E> findFirst(Predicate<? super E> filter)
      Returns the optional first value of the associated enum type that matches the given filter or, if no such value exists, Optional.empty().
    • findFirst

      public final E findFirst(Predicate<? super E> filter, E fallback)
      Returns the first value of the associated enum type that matches the given filter or, if no such value exists, the given fallback.
    • mapAll

      public final <T> Stream<T> mapAll(Function<? super E,? extends T> mapping)
    • mapAll

      public final <T> Stream<T> mapAll(Predicate<? super E> filter, Function<? super E,? extends T> mapping)
    • mapAny

      public final <R> Optional<R> mapAny(Predicate<? super E> filter, Function<? super E,? extends R> mapping)
    • mapFirst

      public final <R> Optional<R> mapFirst(Predicate<? super E> filter, Function<? super E,? extends R> mapping)