OpenVidu / openvidu

OpenVidu Platform main repository
https://openvidu.io
Apache License 2.0
1.86k stars 464 forks source link

openvidu-java-client : change to lambda function #821

Open lastname-dev opened 10 months ago

lastname-dev commented 10 months ago
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.