You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/03/07 22:29:54 UTC

svn commit: r1298133 - /myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java

Author: lu4242
Date: Wed Mar  7 21:29:54 2012
New Revision: 1298133

URL: http://svn.apache.org/viewvc?rev=1298133&view=rev
Log:
MYFACES-3480 [perf] Use lazy init for HashMap/HastSet where possible (Thanks to Martin Koci for provide this patch)

Modified:
    myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java

Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java?rev=1298133&r1=1298132&r2=1298133&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java Wed Mar  7 21:29:54 2012
@@ -218,7 +218,7 @@ class _ComponentAttributesMap implements
      */
     public Collection<Object> values()
     {
-        return getUnderlyingMap(true).values();
+        return getUnderlyingMap().values();
     }
 
     /**
@@ -238,7 +238,7 @@ class _ComponentAttributesMap implements
      */
     public Set<Map.Entry<String, Object>> entrySet()
     {
-        return getUnderlyingMap(true).entrySet();
+        return getUnderlyingMap().entrySet();
     }
 
     /**
@@ -247,7 +247,7 @@ class _ComponentAttributesMap implements
      */
     public Set<String> keySet()
     {
-        return getUnderlyingMap(true).keySet();
+        return getUnderlyingMap().keySet();
     }
 
     /**
@@ -613,20 +613,6 @@ class _ComponentAttributesMap implements
         return attributes == null ? Collections.EMPTY_MAP : attributes;
     }
     
-    Map<String, Object> getUnderlyingMap(boolean create)
-    {
-        if (create)
-        {
-            Map attributes
-                    = (Map<String, Object>) _component.getStateHelper().get(UIComponentBase.PropertyKeys.attributesMap);
-            return attributes == null ? Collections.EMPTY_MAP : attributes;
-        }
-        else
-        {
-            return getUnderlyingMap();
-        }
-    }
-
     /**
      * TODO: Document why this method is necessary, and why it doesn't try to
      * compare the _component field.