commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Vahrst (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-322) Adds a Collections wrapper around the w3c NodeList
Date Sun, 27 Jan 2013 07:09:13 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13563743#comment-13563743
] 

Thomas Vahrst commented on COLLECTIONS-322:
-------------------------------------------

There is a small sample code in the javadoc of IteratorUtils.nodelistIterator(Node) which
doesn't match.:
{code}
    * Convenience method, allows easy iteration over NodeLists:
     * <pre>
     *   for(Node childNode : IteratorUtils.asIterable(node)){
     *     ...
     *   }
     * </pre>

{code}

Should now be :

{code}
    * Convenience method, allows easy iteration over NodeLists:
     * <pre>
     *   Iterable<Node> iterable = IteratorUtils.nodeListIterator(node);
     *   for(Node childNode : IteratorUtils.asIterable(iterable)){
     *     ...
     *   }
     * </pre>

{code} 

... or perhaps better using the iterator in a while loop:

{code}
    * Convenience method, allows easy iteration over NodeLists:
     * <pre>
     *  Iterator<Node> iterator = IteratorUtils.nodeListIterator(nodeList);
     *  while(iterator.hasNext()){
     *      Node childNode = iterator.next();
     *      ...
     *  }
     * </pre>
{code}

                
> Adds a Collections wrapper around the w3c NodeList
> --------------------------------------------------
>
>                 Key: COLLECTIONS-322
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-322
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: List
>            Reporter: Hasan Diwan
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: NodeListAsCollection.java, nodelistAsIterable.patch, patch.txt,
TestNodeListAsCollection.java
>
>
> org.w3c.dom.NodeList is defined as an "abstract collection of Nodes" and java.util.List
is defined as "An ordered collection (also known as a sequence). The user of this interface
has precise control over where in the list each element is inserted. The user can access elements
by their integer index (position in the list), and search for elements in the list.". It seemed
similar enough, so I did an implementation of the useful methods, while throwing the appropriate
exception when the method wouldn't make sense.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message