It's pretty easy to add in the functionality anyway, if you really want it:
import java.util.AbstractList; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; /** * An immutable list view of NodeList<T> * @author thobel * */ public class NodeListWrapper<T extends Node> extends AbstractList<T> { private NodeList<T> nodeList; public NodeListWrapper(NodeList<T> nodeList){ this.nodeList = nodeList; } @Override public T get(int n) { return nodeList.getItem(n); } @Override public int size() { return nodeList.getLength(); } } On Feb 2, 6:04 am, Simon B <simon.bott...@gmail.com> wrote: > Thanks Lothar for your reply, > > Sorry, you're right, I meant why doesn't it support java.lang.Iterable > (and implement a method iterator()) that can be used in a for each > loop, > > Cheers for your suggestion about looking in the forums for the same > question regarding the java.awt.List / java.swing.JList, I'll check > that out > > Simon > > On Feb 2, 6:38 am, Lothar Kimmeringer <j...@kimmeringer.de> wrote: > > > Simon B schrieb: > > > > I apologise if this is a stupid question, or If I'm missing something, > > > but why doesn't > > > com.google.gwt.xml.client.NodeList > > > extend > > > java.util.Iterator > > > Because no List (java.util.List or java.awt.List) do. > > > > it would be handy as thenNodeListcould be used with the shortened > > > for each block a la: > > > for (Node aNode :nodeList) { > > > So you mean java.util.Iterable as being described e.g. > > inhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html > > > > Rather than > > > for (int i = 0; i <nodeList.length(); i++) { > > > Node aNode =nodeList.item(i); > > > .... > > > } > > > It seems a really obvious oversight, so I'm sure that there's a good > > > reason, I'd just like to know what it is. > > > I don't know the reason but you might ask SUN, why they don't do > > the same for their GUI-elements > > likehttp://java.sun.com/j2se/1.5.0/docs/api/java/awt/List.html > > orhttp://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JList.html > > > Regards, Lothar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---