[Minor] Compacting memory on HashMap and HashSet usage
This commit is contained in:
parent
885e5ebf04
commit
428b589d47
|
@ -153,7 +153,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
*/
|
||||
public void addParameter(String bagKey, Parameter<?> parameter) throws StrolchException {
|
||||
if (this.parameterBagMap == null) {
|
||||
this.parameterBagMap = new HashMap<>();
|
||||
this.parameterBagMap = new HashMap<>(1, 1.0F);
|
||||
}
|
||||
ParameterBag bag = this.parameterBagMap.get(bagKey);
|
||||
if (bag == null) {
|
||||
|
@ -250,7 +250,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
*/
|
||||
public void addParameterBag(ParameterBag bag) {
|
||||
if (this.parameterBagMap == null) {
|
||||
this.parameterBagMap = new HashMap<>();
|
||||
this.parameterBagMap = new HashMap<>(1, 1.0F);
|
||||
}
|
||||
|
||||
if (this.parameterBagMap.containsKey(bag.getId())) {
|
||||
|
|
|
@ -133,7 +133,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
*/
|
||||
public void addParameter(Parameter<?> parameter) {
|
||||
if (this.parameterMap == null) {
|
||||
this.parameterMap = new HashMap<>();
|
||||
this.parameterMap = new HashMap<>(1, 1.0F);
|
||||
}
|
||||
|
||||
if (this.parameterMap.containsKey(parameter.getId())) {
|
||||
|
|
|
@ -85,7 +85,7 @@ public class Resource extends AbstractStrolchRootElement implements StrolchRootE
|
|||
@SuppressWarnings("unchecked")
|
||||
public void addTimedState(StrolchTimedState<?> strolchTimedState) {
|
||||
if (this.timedStateMap == null) {
|
||||
this.timedStateMap = new HashMap<>();
|
||||
this.timedStateMap = new HashMap<>(1, 1.0F);
|
||||
}
|
||||
|
||||
if (this.timedStateMap.containsKey(strolchTimedState.getId())) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class PolicyDefs {
|
|||
private Map<String, PolicyDef> policyDefMap;
|
||||
|
||||
public PolicyDefs() {
|
||||
this.policyDefMap = new HashMap<>(0);
|
||||
this.policyDefMap = new HashMap<>(1, 1.0F);
|
||||
}
|
||||
|
||||
public void setParent(StrolchElement parent) {
|
||||
|
|
|
@ -114,7 +114,7 @@ public class SystemHelper {
|
|||
sb.append(SystemHelper.getMaxMemory());
|
||||
sb.append(" / Used: "); //$NON-NLS-1$
|
||||
sb.append(SystemHelper.getUsedMemory());
|
||||
sb.append(" / Free:"); //$NON-NLS-1$
|
||||
sb.append(" / Free: "); //$NON-NLS-1$
|
||||
sb.append(SystemHelper.getFreeMemory());
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue