ofuks commented on a change in pull request #996:
URL: https://github.com/apache/incubator-datalab/pull/996#discussion_r535287775
##########
File path:
services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourcesStatusCallbackHandler.java
##########
@@ -115,9 +114,17 @@ public void handleError(String errorMessage) {
.collect(Collectors.toList());
}
- private Map<String, EnvResource> getEnvResources(List<EnvResource>
envResources) {
- return envResources
- .stream()
+ private Map<String, EnvResource> getEnvResources(EnvResourceList
envResources) {
+ List<EnvResource> envCopy =
Stream.concat(envResources.getClusterList().stream(),
envResources.getHostList().stream())
+ .collect(Collectors.toList());
+
+ return envCopy.stream()
.collect(Collectors.toMap(EnvResource::getId, e -> e));
Review comment:
Can we inline it?
##########
File path:
services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourcesStatusCallbackHandler.java
##########
@@ -115,9 +114,17 @@ public void handleError(String errorMessage) {
.collect(Collectors.toList());
}
- private Map<String, EnvResource> getEnvResources(List<EnvResource>
envResources) {
- return envResources
- .stream()
+ private Map<String, EnvResource> getEnvResources(EnvResourceList
envResources) {
+ List<EnvResource> envCopy =
Stream.concat(envResources.getClusterList().stream(),
envResources.getHostList().stream())
+ .collect(Collectors.toList());
+
+ return envCopy.stream()
.collect(Collectors.toMap(EnvResource::getId, e -> e));
}
+
+ private List<EnvResource> getListOrEmpty(List<EnvResource> source) {
+ return source != null ?
+ getChangedEnvResources(source) :
+ Collections.emptyList();
+ }
Review comment:
Can we use the Optional class with its methods instead?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]