From 27d5266e24e74757c655340decdc95311cb79ec1 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Fri, 6 Apr 2012 18:06:23 +0000 Subject: 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 --- src/java/org/apache/fop/area/Area.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/java/org/apache') 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(20); + traits = new java.util.TreeMap(); } 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; } -- cgit v1.2.3