View Javadoc

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