diff options
author | Glenn Adams <gadams@apache.org> | 2012-04-06 18:06:23 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2012-04-06 18:06:23 +0000 |
commit | 27d5266e24e74757c655340decdc95311cb79ec1 (patch) | |
tree | ca17560a28e47d2b77f865cd7764daf0b85ecbc6 /src/java/org/apache | |
parent | e3a156d11eccb3d56ee21d250c114a077697b73f (diff) | |
download | xmlgraphics-fop-27d5266e24e74757c655340decdc95311cb79ec1.tar.gz xmlgraphics-fop-27d5266e24e74757c655340decdc95311cb79ec1.zip |
Bugzilla #51808: Fixed memory waste in traits map.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1310524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/area/Area.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index bdd886e2c..ce9d9638c 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -390,8 +390,10 @@ public class Area extends AreaTreeObject implements Serializable { * @param prop the value of the trait */ public void addTrait(Integer traitCode, Object prop) { + // use treemap instead of hashmap since the typical number + // of traits are less than four if (traits == null) { - traits = new java.util.HashMap<Integer, Object>(20); + traits = new java.util.TreeMap<Integer, Object>(); } traits.put(traitCode, prop); } @@ -403,7 +405,7 @@ public class Area extends AreaTreeObject implements Serializable { */ public void setTraits ( Map traits ) { if ( traits != null ) { - this.traits = new java.util.HashMap ( traits ); + this.traits = new java.util.TreeMap ( traits ); } else { this.traits = null; } |