xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gad...@apache.org
Subject svn commit: r1310524 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java
Date Fri, 06 Apr 2012 18:06:23 GMT
Author: gadams
Date: Fri Apr  6 18:06:23 2012
New Revision: 1310524

URL: http://svn.apache.org/viewvc?rev=1310524&view=rev
Log:
Bugzilla #51808: Fixed memory waste in traits map.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java?rev=1310524&r1=1310523&r2=1310524&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java Fri Apr  6 18:06:23 2012
@@ -390,8 +390,10 @@ public class Area extends AreaTreeObject
      * @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
      */
     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;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message