Class PredicatedConsumer<T>

  • Type Parameters:
    T - type being predicated and consumed
    All Implemented Interfaces:
    Consumer<T>

    public class PredicatedConsumer<T>
    extends Object
    implements Consumer<T>

    A Consumer that only gets triggered if a given predicate is true.

    A null predicate evaluates to true and is the same as using a regular Consumer.

    A null consumer has no effect and renders this class useless.

    Setting the "negate" constructor argument to true will perform the same predicate evaluation, but will only trigger the consumers if it returns false.

    Since:
    2.0.0
    Author:
    Pascal Essiembre