KickJava   Java API By Example, From Geeks To Geeks.

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


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.SortedMap JavaDoc;
19
20 /**
21  * Defines a map that allows bidirectional lookup between key and values
22  * and retains both keys and values in sorted order.
23  * <p>
24  * Implementations should allow a value to be looked up from a key and
25  * a key to be looked up from a value with equal performance.
26  *
27  * @since Commons Collections 3.0
28  * @version $Revision: 1.6 $ $Date: 2004/02/18 01:15:42 $
29  *
30  * @author Stephen Colebourne
31  */

32 public interface SortedBidiMap extends OrderedBidiMap, SortedMap JavaDoc {
33
34     /**
35      * Gets a view of this map where the keys and values are reversed.
36      * <p>
37      * Changes to one map will be visible in the other and vice versa.
38      * This enables both directions of the map to be accessed equally.
39      * <p>
40      * Implementations should seek to avoid creating a new object every time this
41      * method is called. See <code>AbstractMap.values()</code> etc. Calling this
42      * method on the inverse map should return the original.
43      * <p>
44      * Implementations must return a <code>SortedBidiMap</code> instance,
45      * usually by forwarding to <code>inverseSortedBidiMap()</code>.
46      *
47      * @return an inverted bidirectional map
48      */

49     public BidiMap inverseBidiMap();
50     
51     /**
52      * Gets a view of this map where the keys and values are reversed.
53      * <p>
54      * Changes to one map will be visible in the other and vice versa.
55      * This enables both directions of the map to be accessed as a <code>SortedMap</code>.
56      * <p>
57      * Implementations should seek to avoid creating a new object every time this
58      * method is called. See <code>AbstractMap.values()</code> etc. Calling this
59      * method on the inverse map should return the original.
60      * <p>
61      * The inverse map returned by <code>inverseBidiMap()</code> should be the
62      * same object as returned by this method.
63      *
64      * @return an inverted bidirectional map
65      */

66     public SortedBidiMap inverseSortedBidiMap();
67     
68 }
69
Popular Tags