xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: Antwort: Re: [XOM-interest] hasChildren vs. getChildCount == 0
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: dvholten AT computer.org
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: Antwort: Re: [XOM-interest] hasChildren vs. getChildCount == 0
- Date: Mon, 9 Feb 2004 10:15:13 -0500
At 2:32 PM +0000 2/9/04, dvholten AT computer.org wrote:
i dont know the actual implementation, but i would guess, that a call to
hasChildren() can get
the requested result faster than a getChildCount, which has to determine
the exact number of childs.
i propose to investigate on the usage-pattern of hasChildren() , and then
decide.
I don't think there's any significant speed difference. Internally, hasChildren calls getChildCount() which itself just calls ArrayList.size(). Both method calls avoid this call if the element has no children.
By my count we have about 3 votes in favor and one opposed. I think I'm going to remove it unless anyone objects strenuously and convincingly. I can always add it back in a future release if this proves to be the wrong decision, but if I include it in 1.0 I'm pretty much committed to it for the future. Dropping it now is the more conservative and agile move.
--
Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
-
Antwort: Re: [XOM-interest] hasChildren vs. getChildCount == 0,
dvholten, 02/09/2004
- Re: Antwort: Re: [XOM-interest] hasChildren vs. getChildCount == 0, Elliotte Rusty Harold, 02/09/2004
Archive powered by MHonArc 2.6.24.