HttpClientResponseHandler<Connection> responseHandler = response -> {
int status = response.getCode();
if (status == 200) {
Connection connection = new Connection(OpenVidu.httpResponseEntityToJson(response.getEntity()));
Session.this.connections.put(connection.getConnectionId(), connection);
return connection;
} else {
throw OpenVidu.openViduHttpException(status);
}
};
In this code, the HttpClientResponseHandler is converted to a lambda function, taking response as a parameter and implementing the handleResponse method. This change simplifies the code while maintaining the same functionality.
In this code, the
HttpClientResponseHandle
r is converted to a lambda function, takingresponse
as a parameter and implementing thehandleResponse
method. This change simplifies the code while maintaining the same functionality.