public < U > U foldRight ( U seed , BiFunction < ? super T , U , U > accumulator ) { return toListAndThen ( list -> { U result = seed ; for ( int i = list . size ( ) - 1 ; i >= 0 ; i -- ) result = accumulator . apply ( list . get ( i ) , result ) ; return result ; } ) ; }
Folds the elements of this stream using the provided seed object and accumulation function going right to left .