Class ConcurrentResults<T>

  • Type Parameters:
    T - The type of result.

    public final class ConcurrentResults<T>
    extends Object
    A class that represents the results produced by a ConcurrentRunner.

    For each instance of this class, only one method should be called. Calling more than one method will cause an exception to be thrown.

    Author:
    Rob Spoor
    Since:
    3.0
    • Method Detail

      • andStreamResults

        public Stream<T> andStreamResults()
        Returns a stream with the results produced by the ConcurrentRunner that created this object.

        If any Executable or ThrowingSupplier threw an error or exception, the returned stream will throw an error or exception when a terminal operator is executed.

        Returns:
        A stream with the results produced by the ConcurrentRunner that created this object.
      • andCollectResults

        public <R> R andCollectResults​(Collector<T,​?,​R> collector)
        Collects the results produced by the ConcurrentRunner that created this object.

        This method is similar to calling andStreamResults() and then collecting the results using the given collector. The main difference is that this method will report every error and exception that was thrown instead of only the first.

        Type Parameters:
        R - The result type of the collector.
        Parameters:
        collector - The collector to use.
        Returns:
        The result of applying the given collector to the results produced by the ConcurrentRunner that created this object.
        Throws:
        NullPointerException - If the given collector is null.
      • andListResults

        public List<T> andListResults()
        Returns a list with the results produced by the ConcurrentRunner that created this object.

        This method is shorthand for calling andCollectResults(Collector) with a collector that returns a list. Whether or not this list is modifiable is unspecified.

        Returns:
        A list with the results produced by the ConcurrentRunner that created this object.