Class Repeated<X,​Y>

  • Type Parameters:
    X - Type of input
    Y - Type of output
    All Implemented Interfaces:
    Func<X,​Y>

    public final class Repeated<X,​Y>
    extends Object
    implements Func<X,​Y>
    Func that repeats its calculation a few times before returning the last result.
    Since:
    0.6
    • Constructor Detail

      • Repeated

        public Repeated​(Func<? super X,​? extends Y> fnc,
                        int max)
        Ctor.

        If max is equal or less than zero apply(Object) will return an exception.

        Parameters:
        fnc - Func original
        max - How many times
    • Method Detail

      • apply

        public Y apply​(X input)
                throws Exception
        Description copied from interface: Func
        Apply it.
        Specified by:
        apply in interface Func<X,​Y>
        Parameters:
        input - The argument
        Returns:
        The result
        Throws:
        Exception - If fails