KickJava   Java API By Example, From Geeks To Geeks.

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


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
6 package com.tc.object.walker;
7
8 import java.util.Iterator JavaDoc;
9 import java.util.Map JavaDoc;
10 import java.util.Map.Entry;
11
12 public class MapNode extends AbstractNode {
13
14   private final Iterator JavaDoc iterator;
15
16   private int index = 0;
17
18   public MapNode(Map JavaDoc map) {
19     super(map);
20     iterator = map.entrySet().iterator();
21   }
22
23   public boolean done() {
24     return !iterator.hasNext();
25   }
26
27   public MemberValue next() {
28     Map.Entry JavaDoc entry = (Entry) iterator.next();
29     return new MapEntry(entry, index++);
30   }
31
32 }
33
Popular Tags