Interface StreamableArbitrary<T,​U>

    • Method Detail

      • reduce

        <R> Arbitrary<R> reduce​(R initial,
                                java.util.function.BiFunction<R,​T,​R> accumulator)
        Given an initial argument use accumulator to produce the final result.
        Type Parameters:
        R - The result type
        Parameters:
        initial - The initial argument. Also the result if streamable is empty
        accumulator - The function used to reduce a streamable into a result one by one
        Returns:
        The result of accumulating all elements in streamable
      • uniqueElements

        @API(status=MAINTAINED,
             since="1.7.3")
        StreamableArbitrary<T,​U> uniqueElements()
        Add the constraint that elements of the generated streamable must be unique, i.e. no two elements must return true when being compared using Object.equals(Object).

        The constraint can be combined with other uniqueElements(Function) constraints.

        Returns:
        new arbitrary instance
      • uniqueElements

        @API(status=MAINTAINED,
             since="1.7.3")
        StreamableArbitrary<T,​U> uniqueElements​(java.util.function.Function<T,​java.lang.Object> by)
        Add the constraint that elements of the generated streamable must be unique relating to an element's "feature" being extracted using the by function. The extracted features are being compared using Object.equals(Object).

        The constraint can be combined with other uniqueElements(Function) constraints.

        Returns:
        new arbitrary instance