001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.commons.collections; 018 019 import java.util.Map; 020 021 /** 022 * Defines a map that can be iterated directly without needing to create an entry set. 023 * <p> 024 * A map iterator is an efficient way of iterating over maps. 025 * There is no need to access the entry set or cast to Map Entry objects. 026 * <pre> 027 * IterableMap map = new HashedMap(); 028 * MapIterator it = map.mapIterator(); 029 * while (it.hasNext()) { 030 * Object key = it.next(); 031 * Object value = it.getValue(); 032 * it.setValue("newValue"); 033 * } 034 * </pre> 035 * 036 * @since Commons Collections 3.0 037 * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ 038 * 039 * @author Stephen Colebourne 040 */ 041 public interface IterableMap extends Map { 042 043 /** 044 * Obtains a <code>MapIterator</code> over the map. 045 * <p> 046 * A map iterator is an efficient way of iterating over maps. 047 * There is no need to access the entry set or cast to Map Entry objects. 048 * <pre> 049 * IterableMap map = new HashedMap(); 050 * MapIterator it = map.mapIterator(); 051 * while (it.hasNext()) { 052 * Object key = it.next(); 053 * Object value = it.getValue(); 054 * it.setValue("newValue"); 055 * } 056 * </pre> 057 * 058 * @return a map iterator 059 */ 060 MapIterator mapIterator(); 061 062 }