Interface MatchAccumulator<M,​R>

  • Type Parameters:
    M - m
    R - r

    public interface MatchAccumulator<M,​R>
    Class to used to accumulate the individual match results (the results of applying the MatchFunction) into an object of type R. This class provides an interface for clients that in its concept is not entirely unlike Collector. Instances of this class, however, are meant to be mutable while collectors are essentially stateless lambda factories. The life cycle of an accumulator (after its creation) spans multiple calls to accumulate(java.lang.Iterable<M>) which cause the accumulator instance to update it's internal and hidden state followed by one or more calls to finish() which produce a final result of type R.
    • Method Detail

      • accumulate

        void accumulate​(Iterable<M> m)
        Accumulates the Iterable handed in into the internal state of the instance.
        Parameters:
        m - and iterable of type M
      • finish

        R finish()
        Compute and return a result based on the internal state of the instance. After calling this method, clients should not call accumulate(java.lang.Iterable<M>) again. Clients should discard this object after this method has been called. Multiple calls to this method, however, must return the same stable result.
        Returns:
        the result