151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/* 251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is free software; you can redistribute it and/or modify it 551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * under the terms of the GNU General Public License version 2 only, as 651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * published by the Free Software Foundation. Oracle designates this 751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * particular file as subject to the "Classpath" exception as provided 851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * by Oracle in the LICENSE file that accompanied this code. 951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is distributed in the hope that it will be useful, but WITHOUT 1151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * version 2 for more details (a copy is included in the LICENSE file that 1451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * accompanied this code). 1551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * You should have received a copy of the GNU General Public License version 1751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2 along with this work; if not, write to the Free Software Foundation, 1851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or visit www.oracle.com if you need additional information or have any 2251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * questions. 2351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 2451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 2551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/* 2651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This file is available under and governed by the GNU General Public 2751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * License version 2 only, as published by the Free Software Foundation. 2851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * However, the following notice accompanied the original version of this 2951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * file: 30242e5bfd7e912be174c03a3c887369a6a9d6cbc2Tobias Thierer * 3151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Written by Doug Lea and Josh Bloch with assistance from members of JCP 3251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * JSR-166 Expert Group and released to the public domain, as explained at 3351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * http://creativecommons.org/publicdomain/zero/1.0/ 3451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 3551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 3651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipackage java.util; 3751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 38fd81a99407d318ea3d8b5782294a0644e580d126Neil Fuller// BEGIN android-note 39fd81a99407d318ea3d8b5782294a0644e580d126Neil Fuller// removed link to collections framework docs 40fd81a99407d318ea3d8b5782294a0644e580d126Neil Fuller// END android-note 41fd81a99407d318ea3d8b5782294a0644e580d126Neil Fuller 4251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/** 4351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * A {@link SortedMap} extended with navigation methods returning the 4451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * closest matches for given search targets. Methods 45b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #lowerEntry}, {@link #floorEntry}, {@link #ceilingEntry}, 46b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * and {@link #higherEntry} return {@code Map.Entry} objects 4751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * associated with keys respectively less than, less than or equal, 4851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * greater than or equal, and greater than a given key, returning 4951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code null} if there is no such key. Similarly, methods 50b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #lowerKey}, {@link #floorKey}, {@link #ceilingKey}, and 51b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #higherKey} return only the associated keys. All of these 5251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * methods are designed for locating, not traversing entries. 5351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 5451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>A {@code NavigableMap} may be accessed and traversed in either 55b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * ascending or descending key order. The {@link #descendingMap} 5651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * method returns a view of the map with the senses of all relational 5751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and directional methods inverted. The performance of ascending 5851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * operations and views is likely to be faster than that of descending 59b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * ones. Methods 60b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #subMap(Object, boolean, Object, boolean) subMap(K, boolean, K, boolean)}, 61b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #headMap(Object, boolean) headMap(K, boolean)}, and 62b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #tailMap(Object, boolean) tailMap(K, boolean)} 63b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * differ from the like-named {@code SortedMap} methods in accepting 64b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * additional arguments describing whether lower and upper bounds are 65b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * inclusive versus exclusive. Submaps of any {@code NavigableMap} 66b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * must implement the {@code NavigableMap} interface. 6751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 68b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * <p>This interface additionally defines methods {@link #firstEntry}, 69b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #pollFirstEntry}, {@link #lastEntry}, and 70b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #pollLastEntry} that return and/or remove the least and 7151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * greatest mappings, if any exist, else returning {@code null}. 7251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 7351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>Implementations of entry-returning methods are expected to 7451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * return {@code Map.Entry} pairs representing snapshots of mappings 7551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * at the time they were produced, and thus generally do <em>not</em> 7651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * support the optional {@code Entry.setValue} method. Note however 7751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * that it is possible to change mappings in the associated map using 7851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * method {@code put}. 7951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 8051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>Methods 8151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@link #subMap(Object, Object) subMap(K, K)}, 8251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@link #headMap(Object) headMap(K)}, and 8351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@link #tailMap(Object) tailMap(K)} 8451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * are specified to return {@code SortedMap} to allow existing 8551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * implementations of {@code SortedMap} to be compatibly retrofitted to 8651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * implement {@code NavigableMap}, but extensions and implementations 8751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * of this interface are encouraged to override these methods to return 8851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code NavigableMap}. Similarly, 89b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@link #keySet()} can be overridden to return {@link NavigableSet}. 9051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 9151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @author Doug Lea 9251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @author Josh Bloch 9351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param <K> the type of keys maintained by this map 9451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param <V> the type of mapped values 9551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @since 1.6 9651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 9751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipublic interface NavigableMap<K,V> extends SortedMap<K,V> { 9851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 9951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the greatest key 10051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * strictly less than the given key, or {@code null} if there is 10151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * no such key. 10251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 10351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 10451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the greatest key less than {@code key}, 10551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 10651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 10751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 10851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 10951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 11051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 11151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> lowerEntry(K key); 11251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 11351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 11451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns the greatest key strictly less than the given key, or 11551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code null} if there is no such key. 11651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 11751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 11851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the greatest key less than {@code key}, 11951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 12051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 12151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 12251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 12351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 12451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 12551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski K lowerKey(K key); 12651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 12751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 12851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the greatest key 12951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * less than or equal to the given key, or {@code null} if there 13051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is no such key. 13151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 13251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 13351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the greatest key less than or equal to 13451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code key}, or {@code null} if there is no such key 13551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 13651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 13751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 13851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 13951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 14051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> floorEntry(K key); 14151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 14251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 14351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns the greatest key less than or equal to the given key, 14451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key. 14551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 14651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 14751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the greatest key less than or equal to {@code key}, 14851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 14951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 15051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 15151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 15251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 15351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 15451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski K floorKey(K key); 15551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 15651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 15751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the least key 15851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * greater than or equal to the given key, or {@code null} if 15951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * there is no such key. 16051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 16151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 16251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the least key greater than or equal to 16351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code key}, or {@code null} if there is no such key 16451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 16551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 16651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 16751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 16851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 16951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> ceilingEntry(K key); 17051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 17151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 17251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns the least key greater than or equal to the given key, 17351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key. 17451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 17551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 17651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the least key greater than or equal to {@code key}, 17751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 17851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 17951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 18051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 18151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 18251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 18351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski K ceilingKey(K key); 18451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 18551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 18651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the least key 18751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * strictly greater than the given key, or {@code null} if there 18851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is no such key. 18951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 19051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 19151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the least key greater than {@code key}, 19251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 19351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 19451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 19551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 19651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 19751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 19851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> higherEntry(K key); 19951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 20051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 20151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns the least key strictly greater than the given key, or 20251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code null} if there is no such key. 20351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 20451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param key the key 20551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the least key greater than {@code key}, 20651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if there is no such key 20751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if the specified key cannot be compared 20851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with the keys currently in the map 20951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if the specified key is null 21051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 21151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 21251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski K higherKey(K key); 21351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 21451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 21551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the least 21651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * key in this map, or {@code null} if the map is empty. 21751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 21851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the least key, 21951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if this map is empty 22051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 22151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> firstEntry(); 22251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 22351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 22451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a key-value mapping associated with the greatest 22551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * key in this map, or {@code null} if the map is empty. 22651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 22751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return an entry with the greatest key, 22851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if this map is empty 22951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 23051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> lastEntry(); 23151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 23251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 23351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Removes and returns a key-value mapping associated with 23451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * the least key in this map, or {@code null} if the map is empty. 23551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 23651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the removed first entry of this map, 23751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if this map is empty 23851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 23951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> pollFirstEntry(); 24051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 24151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 24251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Removes and returns a key-value mapping associated with 24351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * the greatest key in this map, or {@code null} if the map is empty. 24451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 24551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return the removed last entry of this map, 24651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or {@code null} if this map is empty 24751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 24851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski Map.Entry<K,V> pollLastEntry(); 24951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 25051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 25151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a reverse order view of the mappings contained in this map. 25251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The descending map is backed by this map, so changes to the map are 25351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * reflected in the descending map, and vice-versa. If either map is 25451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * modified while an iteration over a collection view of either map 25551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is in progress (except through the iterator's own {@code remove} 25651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * operation), the results of the iteration are undefined. 25751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 25851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>The returned map has an ordering equivalent to 259fd81a99407d318ea3d8b5782294a0644e580d126Neil Fuller * {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}. 26051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The expression {@code m.descendingMap().descendingMap()} returns a 26151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * view of {@code m} essentially equivalent to {@code m}. 26251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 26351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a reverse order view of this map 26451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 26551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableMap<K,V> descendingMap(); 26651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 26751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 26851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a {@link NavigableSet} view of the keys contained in this map. 26951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The set's iterator returns the keys in ascending order. 27051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The set is backed by the map, so changes to the map are reflected in 27151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * the set, and vice-versa. If the map is modified while an iteration 27251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * over the set is in progress (except through the iterator's own {@code 27351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * remove} operation), the results of the iteration are undefined. The 27451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * set supports element removal, which removes the corresponding mapping 27551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * from the map, via the {@code Iterator.remove}, {@code Set.remove}, 27651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code removeAll}, {@code retainAll}, and {@code clear} operations. 27751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * It does not support the {@code add} or {@code addAll} operations. 27851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 27951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a navigable set view of the keys in this map 28051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 28151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableSet<K> navigableKeySet(); 28251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 28351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 28451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a reverse order {@link NavigableSet} view of the keys contained in this map. 28551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The set's iterator returns the keys in descending order. 28651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The set is backed by the map, so changes to the map are reflected in 28751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * the set, and vice-versa. If the map is modified while an iteration 28851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * over the set is in progress (except through the iterator's own {@code 28951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * remove} operation), the results of the iteration are undefined. The 29051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * set supports element removal, which removes the corresponding mapping 29151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * from the map, via the {@code Iterator.remove}, {@code Set.remove}, 29251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code removeAll}, {@code retainAll}, and {@code clear} operations. 29351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * It does not support the {@code add} or {@code addAll} operations. 29451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 29551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a reverse order navigable set view of the keys in this map 29651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 29751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableSet<K> descendingKeySet(); 29851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 29951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 30051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a view of the portion of this map whose keys range from 30151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code fromKey} to {@code toKey}. If {@code fromKey} and 30251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code toKey} are equal, the returned map is empty unless 303b8b75116273ecfdb8ffdd1869b1c0dd04570a95ePrzemyslaw Szczepaniak * {@code fromInclusive} and {@code toInclusive} are both true. The 30451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * returned map is backed by this map, so changes in the returned map are 30551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * reflected in this map, and vice-versa. The returned map supports all 30651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * optional map operations that this map supports. 30751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 30851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>The returned map will throw an {@code IllegalArgumentException} 30951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * on an attempt to insert a key outside of its range, or to construct a 31051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * submap either of whose endpoints lie outside its range. 31151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 31251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param fromKey low endpoint of the keys in the returned map 31351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param fromInclusive {@code true} if the low endpoint 31451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is to be included in the returned view 31551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param toKey high endpoint of the keys in the returned map 31651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param toInclusive {@code true} if the high endpoint 31751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is to be included in the returned view 31851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a view of the portion of this map whose keys range from 31951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code fromKey} to {@code toKey} 32051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if {@code fromKey} and {@code toKey} 32151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * cannot be compared to one another using this map's comparator 32251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * (or, if the map has no comparator, using natural ordering). 32351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Implementations may, but are not required to, throw this 32451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * exception if {@code fromKey} or {@code toKey} 32551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * cannot be compared to keys currently in the map. 32651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if {@code fromKey} or {@code toKey} 32751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is null and this map does not permit null keys 32851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException if {@code fromKey} is greater than 32951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@code toKey}; or if this map itself has a restricted 33051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * range, and {@code fromKey} or {@code toKey} lies 33151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * outside the bounds of the range 33251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 33351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, 33451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski K toKey, boolean toInclusive); 33551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 33651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 33751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a view of the portion of this map whose keys are less than (or 33851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * equal to, if {@code inclusive} is true) {@code toKey}. The returned 33951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * map is backed by this map, so changes in the returned map are reflected 34051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * in this map, and vice-versa. The returned map supports all optional 34151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * map operations that this map supports. 34251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 34351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>The returned map will throw an {@code IllegalArgumentException} 34451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * on an attempt to insert a key outside its range. 34551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 34651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param toKey high endpoint of the keys in the returned map 34751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param inclusive {@code true} if the high endpoint 34851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is to be included in the returned view 34951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a view of the portion of this map whose keys are less than 35051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * (or equal to, if {@code inclusive} is true) {@code toKey} 35151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if {@code toKey} is not compatible 35251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with this map's comparator (or, if the map has no comparator, 35351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * if {@code toKey} does not implement {@link Comparable}). 35451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Implementations may, but are not required to, throw this 35551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * exception if {@code toKey} cannot be compared to keys 35651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * currently in the map. 35751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if {@code toKey} is null 35851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 35951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException if this map itself has a 36051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * restricted range, and {@code toKey} lies outside the 36151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * bounds of the range 36251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 36351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableMap<K,V> headMap(K toKey, boolean inclusive); 36451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 36551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 36651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Returns a view of the portion of this map whose keys are greater than (or 36751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * equal to, if {@code inclusive} is true) {@code fromKey}. The returned 36851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * map is backed by this map, so changes in the returned map are reflected 36951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * in this map, and vice-versa. The returned map supports all optional 37051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * map operations that this map supports. 37151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 37251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>The returned map will throw an {@code IllegalArgumentException} 37351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * on an attempt to insert a key outside its range. 37451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 37551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param fromKey low endpoint of the keys in the returned map 37651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param inclusive {@code true} if the low endpoint 37751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * is to be included in the returned view 37851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @return a view of the portion of this map whose keys are greater than 37951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * (or equal to, if {@code inclusive} is true) {@code fromKey} 38051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException if {@code fromKey} is not compatible 38151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with this map's comparator (or, if the map has no comparator, 38251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * if {@code fromKey} does not implement {@link Comparable}). 38351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Implementations may, but are not required to, throw this 38451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * exception if {@code fromKey} cannot be compared to keys 38551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * currently in the map. 38651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException if {@code fromKey} is null 38751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and this map does not permit null keys 38851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException if this map itself has a 38951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * restricted range, and {@code fromKey} lies outside the 39051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * bounds of the range 39151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 39251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski NavigableMap<K,V> tailMap(K fromKey, boolean inclusive); 39351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 39451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 39551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@inheritDoc} 39651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 39751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>Equivalent to {@code subMap(fromKey, true, toKey, false)}. 39851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 39951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException {@inheritDoc} 40051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException {@inheritDoc} 40151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException {@inheritDoc} 40251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 40351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski SortedMap<K,V> subMap(K fromKey, K toKey); 40451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 40551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 40651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@inheritDoc} 40751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 40851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>Equivalent to {@code headMap(toKey, false)}. 40951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 41051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException {@inheritDoc} 41151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException {@inheritDoc} 41251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException {@inheritDoc} 41351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 41451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski SortedMap<K,V> headMap(K toKey); 41551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 41651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 41751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * {@inheritDoc} 41851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 41951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>Equivalent to {@code tailMap(fromKey, true)}. 42051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 42151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws ClassCastException {@inheritDoc} 42251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws NullPointerException {@inheritDoc} 42351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @throws IllegalArgumentException {@inheritDoc} 42451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 42551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski SortedMap<K,V> tailMap(K fromKey); 42651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski} 427