public < T , R , A > R collect ( Stream < T > stream , Collector < ? super T , A , R > collector ) { Callable < R > callable = ( ) -> stream . collect ( collector ) ; return ThreadMethods . forkJoinExecution ( callable , concurrencyConfiguration , stream . isParallel ( ) ) ; }
Executes collect on the provided stream using the provided collector . If the Stream is parallel it is executed using the custom pool else it is executed directly from the main thread .