You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Dmitri Plotnikov <dm...@apache.org> on 2004/02/11 16:50:10 UTC
Re: [Bug 26853] New: - Improving MapDynamicPropertyHandler
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
--- bugzilla@apache.org 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: commons-dev@jakarta.apache.org
> ReportedBy: ydu@zurich.ibm.com
>
>
> 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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org