jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend java.lang.Iterable
Date Wed, 20 May 2009 09:25:18 GMT
Thomas Müller wrote:
> Hi,
> 
> I believe this is the right solution for now. With static import:
> 
> for (Node child : childNodes(node)) { ... }
> 
> This is far more readable than:
> 
> for (NodeIterator it = node.getNodes(); it.hasNext();) {
>     Node child = it.nextNode();
>     ...
> }

I disagree here; it depends on how familiar the reader is with static 
imports in general, and JCRUtils in particular. It's shorter, but 
requires additional knowledge of both language and libraries in use.

> The best API would be probably:
> for (Node child : node.getNodeList())
> ...

The best API would be:

   for (Node child : node.getNodes())
   ...

and I think we get there once java.util.Iterator implements Iterable, 
which I think is planned for future Java release.

BR, Julian



Mime
View raw message