01: /*
02: * Copyright (C) 2004 NNL Technology AB
03: * Visit www.infonode.net for information about InfoNode(R)
04: * products and how to contact NNL Technology AB.
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19: * MA 02111-1307, USA.
20: */
21:
22: // $Id: ConstMapIterator.java,v 1.3 2004/09/22 14:35:05 jesper Exp $
23: package net.infonode.util.collection.map.base;
24:
25: /**
26: * An iterator for a map.
27: * The iterator points to a map entry when it's created so {@link #next} shouldn't be called at the start of the
28: * iteration.
29: * <p>
30: * Here's an example on how to iterate over a map:
31: * <code>
32: * for (ConstIterator iterator = map.constIterator(); iterator.atEntry(); iterator.next()) {
33: * Object key = iterator.getKey();
34: * Object value = iterator.getValue();
35: * ...
36: * }
37: * </code>
38: *
39: * @author $Author: jesper $
40: * @version $Revision: 1.3 $
41: */
42: public interface ConstMapIterator {
43: /**
44: * Returns the key at the current map entry.
45: *
46: * @return the key at the current map entry
47: */
48: Object getKey();
49:
50: /**
51: * Returns the value at the current map entry.
52: *
53: * @return the value at the current map entry
54: */
55: Object getValue();
56:
57: /**
58: * Advance the iterator to the next entry.
59: */
60: void next();
61:
62: /**
63: * Returns true if the iterator points to an entry in the map.
64: *
65: * @return true if the iterator points to an entry in the map
66: */
67: boolean atEntry();
68: }
|