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.SortedMap;
020
021 /**
022 * Defines a map that allows bidirectional lookup between key and values
023 * and retains both keys and values in sorted order.
024 * <p>
025 * Implementations should allow a value to be looked up from a key and
026 * a key to be looked up from a value with equal performance.
027 *
028 * @since Commons Collections 3.0
029 * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
030 *
031 * @author Stephen Colebourne
032 */
033 public interface SortedBidiMap extends OrderedBidiMap, SortedMap {
034
035 /**
036 * Gets a view of this map where the keys and values are reversed.
037 * <p>
038 * Changes to one map will be visible in the other and vice versa.
039 * This enables both directions of the map to be accessed equally.
040 * <p>
041 * Implementations should seek to avoid creating a new object every time this
042 * method is called. See <code>AbstractMap.values()</code> etc. Calling this
043 * method on the inverse map should return the original.
044 * <p>
045 * Implementations must return a <code>SortedBidiMap</code> instance,
046 * usually by forwarding to <code>inverseSortedBidiMap()</code>.
047 *
048 * @return an inverted bidirectional map
049 */
050 public BidiMap inverseBidiMap();
051
052 /**
053 * Gets a view of this map where the keys and values are reversed.
054 * <p>
055 * Changes to one map will be visible in the other and vice versa.
056 * This enables both directions of the map to be accessed as a <code>SortedMap</code>.
057 * <p>
058 * Implementations should seek to avoid creating a new object every time this
059 * method is called. See <code>AbstractMap.values()</code> etc. Calling this
060 * method on the inverse map should return the original.
061 * <p>
062 * The inverse map returned by <code>inverseBidiMap()</code> should be the
063 * same object as returned by this method.
064 *
065 * @return an inverted bidirectional map
066 */
067 public SortedBidiMap inverseSortedBidiMap();
068
069 }