private List < Map < String , Result < R > > > handleRetcodeBatchingHack ( List < Map < String , Result < R > > > list , Type xor ) { return list . stream ( ) . map ( m -> { return m . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( e -> e . getKey ( ) , e -> { return e . getValue ( ) . fold ( err -> { return err . < Result < R > > fold ( Result :: error , Result :: error , parsingError -> { if ( parsingError . getJson ( ) . isJsonObject ( ) ) { JsonObject jsonObject = parsingError . getJson ( ) . getAsJsonObject ( ) ; if ( jsonObject . has ( "retcode" ) ) { jsonObject . remove ( "retcode" ) ; return JsonParser . GSON . fromJson ( jsonObject , xor ) ; } else { return Result . error ( parsingError ) ; } } else { return Result . error ( parsingError ) ; } } , Result :: error ) ; } , Result :: success ) ; } ) ) ; } ) . collect ( Collectors . toList ( ) ) ; }
specific to how a function is dispatched .