[jboss-cvs] jboss-seam/src/main/org/jboss/seam/international ...
Peter Muir
peter at bleepbleep.org.uk
Tue Nov 20 06:51:34 EST 2007
User: pmuir
Date: 07/11/20 06:51:34
Modified: src/main/org/jboss/seam/international Messages.java
Log:
JBSEAM-2192
Revision Changes Path
1.9 +27 -4 jboss-seam/src/main/org/jboss/seam/international/Messages.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Messages.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/international/Messages.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Messages.java 10 Jul 2007 16:46:58 -0000 1.8
+++ Messages.java 20 Nov 2007 11:51:34 -0000 1.9
@@ -4,8 +4,10 @@
import static org.jboss.seam.annotations.Install.BUILT_IN;
import java.util.AbstractMap;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
@@ -38,6 +40,8 @@
protected Map createMap()
{
+ // AbstractMap uses the implementation of entrySet to perform all its
+ // operations - for a resource bundle this is very inefficient for keys
return new AbstractMap<String, String>()
{
private java.util.ResourceBundle bundle = SeamResourceBundle.getBundle();
@@ -78,7 +82,26 @@
String key = keys.nextElement();
map.put( key, get(key) );
}
- return map.entrySet();
+ return Collections.unmodifiableSet(map.entrySet());
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ return get(key) != null;
+ }
+
+ @Override
+ public Set<String> keySet()
+ {
+ Enumeration<String> keys = bundle.getKeys();
+ return new HashSet<String>(Collections.list(keys));
+ }
+
+ @Override
+ public int size()
+ {
+ return keySet().size();
}
};
More information about the jboss-cvs-commits
mailing list