どのように私は別のラムダ式でラムダ式からオブジェクトを使用することができます

Meladバジル

私はこのコードを持っています

service.confirm(identity, id)
                .map(confirmationResponse -> InternalToExternalResponse.mapToExternal(confirmationResponse))
                .map(externalResponse->uriBuilder.buildAuthorizeUri(externalResponse))
                .lift(auditOperatorFactory.logRequestURI(identity, AuditCategory.BOOKKEEP));

今、私は拡張する必要がありますuriBuilder.buildAuthorizeUri(externalResponse)取るためにconfirmationResponse2番目のパラメータとして

私は使用することができますconfirmationResponse第二ラムダ式内の最初のラムダ式から?最終的なコードは次のようにする必要があります

service.confirm(identity, id)
                .map(confirmationResponse -> InternalToExternalResponse.mapToExternal(confirmationResponse))
                .map(externalResponse-**>uriBuilder.buildAuthorizeUri(externalResponse,confirmationResponse ))**
                .lift(auditOperatorFactory.logRequestURI(identity, AuditCategory.BOOKKEEP));
人々Ahmeti:

あなたは渡すことができconfirmationResponse、この1の結果として、次のラムダに。あなたは両方を必要とするので、あなたはどちらかのカスタムオブジェクトまたは使用作成することができPair、このように:

service.confirm(identity, id)
                .map(confirmationResponse -> new Pair<ConfirmationResponse, ExternalResponse>(confirmationResponse, InternalToExternalResponse.mapToExternal(confirmationResponse)))
                .map(result ->u riBuilder.buildAuthorizeUri(result.second, result.first ))
                .lift(auditOperatorFactory.logRequestURI(identity, AuditCategory.BOOKKEEP));

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=196603&siteId=1