[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 {
|
public void addParameter(String bagKey, Parameter<?> parameter) throws StrolchException {
|
||||||
if (this.parameterBagMap == null) {
|
if (this.parameterBagMap == null) {
|
||||||
this.parameterBagMap = new HashMap<>();
|
this.parameterBagMap = new HashMap<>(1, 1.0F);
|
||||||
}
|
}
|
||||||
ParameterBag bag = this.parameterBagMap.get(bagKey);
|
ParameterBag bag = this.parameterBagMap.get(bagKey);
|
||||||
if (bag == null) {
|
if (bag == null) {
|
||||||
|
@ -250,7 +250,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
||||||
*/
|
*/
|
||||||
public void addParameterBag(ParameterBag bag) {
|
public void addParameterBag(ParameterBag bag) {
|
||||||
if (this.parameterBagMap == null) {
|
if (this.parameterBagMap == null) {
|
||||||
this.parameterBagMap = new HashMap<>();
|
this.parameterBagMap = new HashMap<>(1, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parameterBagMap.containsKey(bag.getId())) {
|
if (this.parameterBagMap.containsKey(bag.getId())) {
|
||||||
|
|
|
@ -133,7 +133,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
||||||
*/
|
*/
|
||||||
public void addParameter(Parameter<?> parameter) {
|
public void addParameter(Parameter<?> parameter) {
|
||||||
if (this.parameterMap == null) {
|
if (this.parameterMap == null) {
|
||||||
this.parameterMap = new HashMap<>();
|
this.parameterMap = new HashMap<>(1, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parameterMap.containsKey(parameter.getId())) {
|
if (this.parameterMap.containsKey(parameter.getId())) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class Resource extends AbstractStrolchRootElement implements StrolchRootE
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void addTimedState(StrolchTimedState<?> strolchTimedState) {
|
public void addTimedState(StrolchTimedState<?> strolchTimedState) {
|
||||||
if (this.timedStateMap == null) {
|
if (this.timedStateMap == null) {
|
||||||
this.timedStateMap = new HashMap<>();
|
this.timedStateMap = new HashMap<>(1, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.timedStateMap.containsKey(strolchTimedState.getId())) {
|
if (this.timedStateMap.containsKey(strolchTimedState.getId())) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class PolicyDefs {
|
||||||
private Map<String, PolicyDef> policyDefMap;
|
private Map<String, PolicyDef> policyDefMap;
|
||||||
|
|
||||||
public PolicyDefs() {
|
public PolicyDefs() {
|
||||||
this.policyDefMap = new HashMap<>(0);
|
this.policyDefMap = new HashMap<>(1, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent(StrolchElement parent) {
|
public void setParent(StrolchElement parent) {
|
||||||
|
|
Loading…
Reference in New Issue