@ ObjectiveCName ( "map:" ) public < R > Promise < R > map ( final Function < T , R > res ) { final Promise < T > self = this ; return new Promise <> ( ( PromiseFunc < R > ) resolver -> { self . then ( t -> { R r ; try { r = res . apply ( t ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; resolver . tryError ( e ) ; return ; } resolver . tryResult ( r ) ; } ) ; self . failure ( e -> resolver . error ( e ) ) ; } ) ; }
Mapping result value of promise to another value