KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > walker > CollectionNode


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.object.walker;
6
7 import java.util.Collection JavaDoc;
8 import java.util.Iterator JavaDoc;
9
10 public class CollectionNode extends AbstractNode implements Node {
11
12   private final Iterator JavaDoc iterator;
13   private int index = 0;
14
15   protected CollectionNode(Collection JavaDoc c) {
16     super(c);
17     iterator = c.iterator();
18   }
19
20   public boolean done() {
21     return !iterator.hasNext();
22   }
23
24   public MemberValue next() {
25     return MemberValue.elementValue(index++, iterator.next());
26   }
27
28 }
29
Popular Tags