01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.commons.collections;
17:
18: import java.util.Map;
19:
20: /**
21: * Defines a map that can be iterated directly without needing to create an entry set.
22: * <p>
23: * A map iterator is an efficient way of iterating over maps.
24: * There is no need to access the entry set or cast to Map Entry objects.
25: * <pre>
26: * IterableMap map = new HashedMap();
27: * MapIterator it = map.mapIterator();
28: * while (it.hasNext()) {
29: * Object key = it.next();
30: * Object value = it.getValue();
31: * it.setValue("newValue");
32: * }
33: * </pre>
34: *
35: * @since Commons Collections 3.0
36: * @version $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
37: *
38: * @author Stephen Colebourne
39: */
40: public interface IterableMap extends Map {
41:
42: /**
43: * Obtains a <code>MapIterator</code> over the map.
44: * <p>
45: * A map iterator is an efficient way of iterating over maps.
46: * There is no need to access the entry set or cast to Map Entry objects.
47: * <pre>
48: * IterableMap map = new HashedMap();
49: * MapIterator it = map.mapIterator();
50: * while (it.hasNext()) {
51: * Object key = it.next();
52: * Object value = it.getValue();
53: * it.setValue("newValue");
54: * }
55: * </pre>
56: *
57: * @return a map iterator
58: */
59: MapIterator mapIterator();
60:
61: }
|