Yann, Sure, I'll commit the change. But just out of curiousity, what is that situtation where map.size() != map.keySet().size()? It almost feels like it would break a bunch of other things.
Thanks for the report. - Dmitri --- [EMAIL PROTECTED] wrote: > DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG > RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT > <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26853>. > ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND > INSERTED IN THE BUG DATABASE. > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26853 > > Improving MapDynamicPropertyHandler > > Summary: Improving MapDynamicPropertyHandler > Product: Commons > Version: Nightly Builds > Platform: All > OS/Version: All > Status: NEW > Severity: Enhancement > Priority: Other > Component: JXPath > AssignedTo: [EMAIL PROTECTED] > ReportedBy: [EMAIL PROTECTED] > > > in: org.apache.commons.jxpath.MapDynamicPropertyHandler > > If the following code: > public String[] getPropertyNames(Object object) { > Map map = (Map) object; > String names[] = new String[map.size()]; > Iterator it = map.keySet().iterator(); > for (int i = 0; i < names.length; i++) { > names[i] = String.valueOf(it.next()); > } > return names; > } > > could be replaced by: > public String[] getPropertyNames(Object object) { > Set keys = ((Map) object).keySet(); > String names[] = new String[keys.size()]; > Iterator it = keys.iterator(); > for (int i = 0; i < names.length; i++) { > names[i] = String.valueOf(it.next()); > } > return names; > } > > > This would permit to support very special cases where > Map.keySet().size() != > Map.size() [which, I know, does not conform to the Map API]. > Anyway, in general, it is better to compute the size on the Set we > are actually > using and not on another one related to it... > > Thanks, > > Yann Duponchel. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]