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. * Defines a map that allows bidirectional lookup between key and values
  19. * and retains and provides access to an ordering.
  20. * <p>
  21. * Implementations should allow a value to be looked up from a key and
  22. * a key to be looked up from a value with equal performance.
  23. *
  24. * @since Commons Collections 3.0
  25. * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
  26. *
  27. * @author Stephen Colebourne
  28. */
  29. public interface OrderedBidiMap extends BidiMap, OrderedMap {
  30. /**
  31. * Gets a view of this map where the keys and values are reversed.
  32. * <p>
  33. * Changes to one map will be visible in the other and vice versa.
  34. * This enables both directions of the map to be accessed equally.
  35. * <p>
  36. * Implementations should seek to avoid creating a new object every time this
  37. * method is called. See <code>AbstractMap.values()</code> etc. Calling this
  38. * method on the inverse map should return the original.
  39. * <p>
  40. * Implementations must return an <code>OrderedBidiMap</code> instance,
  41. * usually by forwarding to <code>inverseOrderedBidiMap()</code>.
  42. *
  43. * @return an inverted bidirectional map
  44. */
  45. public BidiMap inverseBidiMap();
  46. /**
  47. * Gets a view of this map where the keys and values are reversed.
  48. * <p>
  49. * Changes to one map will be visible in the other and vice versa.
  50. * This enables both directions of the map to be accessed equally.
  51. * <p>
  52. * Implementations should seek to avoid creating a new object every time this
  53. * method is called. See <code>AbstractMap.values()</code> etc. Calling this
  54. * method on the inverse map should return the original.
  55. *
  56. * @return an inverted bidirectional map
  57. */
  58. public OrderedBidiMap inverseOrderedBidiMap();
  59. }