aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsindhu3672 <arcot.sindhuri@huawei.com>2019-08-08 14:42:50 +0530
committersindhu3672 <arcot.sindhuri@huawei.com>2019-08-08 14:42:50 +0530
commit0e7aae7f2480cb9c5e438949aa033139b861f22d (patch)
tree3bc97e4340875b36662bffc22ca007a9b4862ea6
parenta1f955a0b3c9e406786ba429ee08a22c95a9b793 (diff)
Replace collections.size with isEmpty for better performance
Replace collections.size with isEmpty for better performance asdc-controller Issue-ID: SO-2187 Signed-off-by: sindhu3672 <arcot.sindhuri@huawei.com> Change-Id: Ie8adc3a149a583fe66c771ee70ae95055a229f83
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java8
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java2
3 files changed, 7 insertions, 7 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 325ba913f8..e048d4c567 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -92,7 +92,7 @@ public class DeployActivitySpecs {
private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
+ if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.isEmpty()) {
return;
}
List<String> categoryList = new ArrayList<>();
@@ -108,7 +108,7 @@ public class DeployActivitySpecs {
private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
+ if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.isEmpty()) {
return;
}
List<Input> inputs = new ArrayList<>();
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index 46c440db0d..a68d98e0b0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -140,7 +140,7 @@ public class WorkflowResource {
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
- List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
+ List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
@@ -174,7 +174,7 @@ public class WorkflowResource {
}
protected List<String> getActivityNameList(String bpmnContent) {
- List<String> activityNameList = new ArrayList<String>();
+ List<String> activityNameList = new ArrayList<>();
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(bpmnContent);
@@ -186,10 +186,10 @@ public class WorkflowResource {
protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames,
Workflow workflow) throws Exception {
- if (activityNames == null || activityNames.size() == 0) {
+ if (activityNames == null || activityNames.isEmpty()) {
return null;
}
- List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<WorkflowActivitySpecSequence>();
+ List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<>();
int seqNo = 1;
for (String activityName : activityNames) {
ActivitySpec activitySpec = activityRepo.findByName(activityName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index ef1e5128de..276b8183a8 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1117,7 +1117,7 @@ public class ToscaResourceInstaller {
}
}
- if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) {
+ if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) {
getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
}
}