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. import java.util.Map;
  18. /**
  19. * Defines a map that can be iterated directly without needing to create an entry set.
  20. * <p>
  21. * A map iterator is an efficient way of iterating over maps.
  22. * There is no need to access the entry set or cast to Map Entry objects.
  23. * <pre>
  24. * IterableMap map = new HashedMap();
  25. * MapIterator it = map.mapIterator();
  26. * while (it.hasNext()) {
  27. * Object key = it.next();
  28. * Object value = it.getValue();
  29. * it.setValue("newValue");
  30. * }
  31. * </pre>
  32. *
  33. * @since Commons Collections 3.0
  34. * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:43 $
  35. *
  36. * @author Stephen Colebourne
  37. */
  38. public interface IterableMap extends Map {
  39. /**
  40. * Obtains a <code>MapIterator</code> over the map.
  41. * <p>
  42. * A map iterator is an efficient way of iterating over maps.
  43. * There is no need to access the entry set or cast to Map Entry objects.
  44. * <pre>
  45. * IterableMap map = new HashedMap();
  46. * MapIterator it = map.mapIterator();
  47. * while (it.hasNext()) {
  48. * Object key = it.next();
  49. * Object value = it.getValue();
  50. * it.setValue("newValue");
  51. * }
  52. * </pre>
  53. *
  54. * @return a map iterator
  55. */
  56. MapIterator mapIterator();
  57. }