This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java.util.Date.toString() really slow?
Bryce McKinlay wrote:
Presumably it would be reasonable to cache negative results for resource
bundle (and class?) lookups. People don't expect to be able to
dynamically add new resource bundles to a running application, right?
How about caching the default bundle:
private static final ResourceBundle defaultBundle =
ResourceBundle.getBundle(bundleName, Locale.getDefault());
private static synchronized Calendar
getInstance(TimeZone zone, Locale locale, ResourceBundle bundle)
{
String calendarClassName = bundle.getString("calendarClass");
if (calendarClassName != null)
...
}
public static Calendar getInstance()
{
return getInstance(TimeZone.getDefault(), Locale.getDefault(),
defaultBundle);
}
public static Calendar getInstance(TimeZone zone)
{
return getInstance(zone, Locale.getDefault(), defaultBundle);
}
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/