protected static Observable < Tuple2 < Integer , Throwable > > errorsWithAttempts ( Observable < ? extends Throwable > errors , final int expectedAttempts ) { return errors . zipWith ( Observable . range ( 1 , expectedAttempts ) , new Func2 < Throwable , Integer , Tuple2 < Integer , Throwable > > ( ) { @ Override public Tuple2 < Integer , Throwable > call ( Throwable error , Integer attempt ) { return Tuple . create ( attempt , error ) ; } } ) ; }
Internal utility method to combine errors in an observable with their attempt number .