From: rama-huawei Date: Wed, 20 Sep 2017 13:03:38 +0000 (+0530) Subject: Used isEmpty to check collection is empty or not X-Git-Tag: v1.1.0~60^2~1 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=c85be0b2c683678dbc94637c93be506216f915e1;p=policy%2Fengine.git Used isEmpty to check collection is empty or not Issue-ID: POLICY-239 Change-Id: I5c6a43ac0f66e02b4f2f6644f0936a846708e2a5 Signed-off-by: rama-huawei --- diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java index a0f1ba86d..7c60ecfdf 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java @@ -202,7 +202,7 @@ class HtmlProcessor extends SimpleCallback { combiningAlgo2human.put("only-one-applicable", "to honour the result of the first successfully evaluated $placeholder$ in order"); } - private Map attributeIdentifiersMap = new HashMap(); + private Map attributeIdentifiersMap = new HashMap<>(); private final StringWriter stringWriter = new StringWriter(); private final PrintWriter htmlOut = new PrintWriter(stringWriter); @@ -357,7 +357,7 @@ class HtmlProcessor extends SimpleCallback { else policySet(policySet, "li"); - if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) + if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) htmlOut.println("
    "); return super.onPreVisitPolicySet(parent, policySet); @@ -377,7 +377,7 @@ class HtmlProcessor extends SimpleCallback { LOGGER.trace("PolicySet: " + policySet.getPolicySetId() + " Description: " + policySet.getDescription()); - if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) + if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) htmlOut.println("
"); htmlOut.println("

"); @@ -421,7 +421,7 @@ class HtmlProcessor extends SimpleCallback { } if (policySet.getPolicySetOrPolicyOrPolicySetIdReference() != null && - policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) { + !policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) { String algoDesc = combiningAlgo2human.get(combiningAlgorithm); if (algoDesc != null) { algoDesc = algoDesc.replace("$placeholder$", "policy") + " (" + "" + combiningAlgorithm + ")"; @@ -449,7 +449,7 @@ class HtmlProcessor extends SimpleCallback { policy(policy); - if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) + if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) htmlOut.println("
    "); return super.onPreVisitPolicy(parent, policy); @@ -464,7 +464,7 @@ class HtmlProcessor extends SimpleCallback { LOGGER.trace("PolicySet: " + policy.getPolicyId() + "Parent PolicySet: " + parent.getPolicySetId() + " Version: " + parent.getVersion()); - if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) + if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) htmlOut.println("
"); htmlOut.println("

"); @@ -506,7 +506,7 @@ class HtmlProcessor extends SimpleCallback { } if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition() != null && - policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) { + !policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) { String algoDesc = combiningAlgo2human.get(combiningAlgorithm); if (algoDesc != null) { algoDesc = algoDesc.replace("$placeholder$", "rule") + " (" + combiningAlgorithm + ")"; @@ -710,7 +710,7 @@ class HtmlProcessor extends SimpleCallback { // StdAttribute attribute = null; AttributeValueType value = match.getAttributeValue(); - String attributeDataType = null; + String attributeDataType; if (match.getAttributeDesignator() != null && value != null) { AttributeDesignatorType designator = match.getAttributeDesignator(); attribute = new StdAttribute(new IdentifierImpl(designator.getCategory()), @@ -822,11 +822,12 @@ class HtmlProcessor extends SimpleCallback { } private String removePrimitives(String in) { - in = in.replace("string-", ""); - in = in.replace("integer-", ""); - in = in.replace("double-", ""); - in = in.replace("boolean-", ""); - return in; + String newIn = in; + newIn = newIn.replace("string-", ""); + newIn = newIn.replace("integer-", ""); + newIn = newIn.replace("double-", ""); + newIn = newIn.replace("boolean-", ""); + return newIn; } private String stringifyCondition(ConditionType condition) {