KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > IterableMap


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 JavaDoc;
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: 1.4 $ $Date: 2004/02/18 01:15:43 $
37  *
38  * @author Stephen Colebourne
39  */

40 public interface IterableMap extends Map JavaDoc {
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 }
62
Popular Tags