Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 33488 invoked from network); 11 Feb 2004 15:50:58 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Feb 2004 15:50:58 -0000 Received: (qmail 89545 invoked by uid 500); 11 Feb 2004 15:50:24 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 89452 invoked by uid 500); 11 Feb 2004 15:50:24 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 89321 invoked from network); 11 Feb 2004 15:50:22 -0000 Received: from unknown (HELO web11706.mail.yahoo.com) (216.136.172.72) by daedalus.apache.org with SMTP; 11 Feb 2004 15:50:22 -0000 Message-ID: <20040211155010.15802.qmail@web11706.mail.yahoo.com> Received: from [198.204.133.208] by web11706.mail.yahoo.com via HTTP; Wed, 11 Feb 2004 07:50:10 PST X-RocketYMMF: dplotnik Date: Wed, 11 Feb 2004 07:50:10 -0800 (PST) From: Dmitri Plotnikov Reply-To: dmitri@apache.org Subject: Re: [Bug 26853] New: - Improving MapDynamicPropertyHandler To: Jakarta Commons Developers List In-Reply-To: <20040211113006.26742.qmail@nagoya.betaversion.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 > . > 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