public < R > PromisesArray < R > map ( final Function < T , Promise < R > > fun ) { return mapSourcePromises ( srcPromise -> new Promise < R > ( resolver -> { srcPromise . then ( t -> { Promise < R > mapped = fun . apply ( t ) ; mapped . then ( t2 -> resolver . result ( t2 ) ) ; mapped . failure ( e -> resolver . error ( e ) ) ; } ) ; srcPromise . failure ( e -> resolver . error ( e ) ) ; } ) ) ; }
Map promises results to new promises