commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <bali...@mwm.lt>
Subject Re: DepthFirstIterator
Date Tue, 06 Nov 2001 12:02:58 GMT
if is usefull Iterator implementation, but implemented incorrectly, method
hasNext() in DepthFirstIterator has side effect  :

 public boolean hasNext() {
  while (!mStack.isEmpty() &&
           !(((Iterator) mStack.peek()).hasNext())) {
// this is a bug !!!
  mStack.pop();
  }
  return !mStack.isEmpty();
 }

----- Original Message -----
From: <Ralph.Wagner@web.de>
To: <commons-dev@jakarta.apache.org>
Sent: Tuesday, November 06, 2001 11:19 AM
Subject: DepthFirstIterator


> Hi all,
> I have written a class, two related interfaces and a helper class that I
find quite useful and wanted to publish somehow. The jakarta commons
collections seems to me the right place to do so.
> The depth first iterator is written to traverse a tree-like structure and
can be used to perform an action on all nodes of a tree.
>
> (See attached file: SingletonIterator.java)(See attached file:
CompositionView.java)(See attached file: DepthFirstIterator.java)(See
attached file: Composition.java)
>
>
> What do you think?
> Ralph
> ---------------------
> email: Ralph.Wagner@web.de
>
> ________________________________________________________________
> WEB.DE - das grosse Horoskop Gewinnspiel!
> http://horoskop.web.de


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message