jdk/src/share/classes/java/util/SortedMap.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.util;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * A {@link Map} that further provides a <i>total ordering</i> on its keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * The map is ordered according to the {@linkplain Comparable natural
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * ordering} of its keys, or by a {@link Comparator} typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * provided at sorted map creation time.  This order is reflected when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * iterating over the sorted map's collection views (returned by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <tt>entrySet</tt>, <tt>keySet</tt> and <tt>values</tt> methods).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Several additional operations are provided to take advantage of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * ordering.  (This interface is the map analogue of {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * SortedSet}.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>All keys inserted into a sorted map must implement the <tt>Comparable</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * interface (or be accepted by the specified comparator).  Furthermore, all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * such keys must be <i>mutually comparable</i>: <tt>k1.compareTo(k2)</tt> (or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <tt>comparator.compare(k1, k2)</tt>) must not throw a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <tt>ClassCastException</tt> for any keys <tt>k1</tt> and <tt>k2</tt> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * the sorted map.  Attempts to violate this restriction will cause the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * offending method or constructor invocation to throw a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <tt>ClassCastException</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <p>Note that the ordering maintained by a sorted map (whether or not an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * explicit comparator is provided) must be <i>consistent with equals</i> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * the sorted map is to correctly implement the <tt>Map</tt> interface.  (See
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * the <tt>Comparable</tt> interface or <tt>Comparator</tt> interface for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * precise definition of <i>consistent with equals</i>.)  This is so because
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * the <tt>Map</tt> interface is defined in terms of the <tt>equals</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * operation, but a sorted map performs all key comparisons using its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <tt>compareTo</tt> (or <tt>compare</tt>) method, so two keys that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * deemed equal by this method are, from the standpoint of the sorted map,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * equal.  The behavior of a tree map <i>is</i> well-defined even if its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * ordering is inconsistent with equals; it just fails to obey the general
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * contract of the <tt>Map</tt> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <p>All general-purpose sorted map implementation classes should
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * provide four "standard" constructors: 1) A void (no arguments)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * constructor, which creates an empty sorted map sorted according to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * the natural ordering of its keys.  2) A constructor with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * single argument of type <tt>Comparator</tt>, which creates an empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * sorted map sorted according to the specified comparator.  3) A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * constructor with a single argument of type <tt>Map</tt>, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * creates a new map with the same key-value mappings as its argument,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * sorted according to the keys' natural ordering.  4) A constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * with a single argument of type <tt>SortedMap</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * which creates a new sorted map with the same key-value mappings and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * the same ordering as the input sorted map.  There is no way to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * enforce this recommendation, as interfaces cannot contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * <p>Note: several methods return submaps with restricted key ranges.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Such ranges are <i>half-open</i>, that is, they include their low
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * endpoint but not their high endpoint (where applicable).  If you need a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * <i>closed range</i> (which includes both endpoints), and the key type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * allows for calculation of the successor of a given key, merely request
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * the subrange from <tt>lowEndpoint</tt> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <tt>successor(highEndpoint)</tt>.  For example, suppose that <tt>m</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * is a map whose keys are strings.  The following idiom obtains a view
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * containing all of the key-value mappings in <tt>m</tt> whose keys are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * between <tt>low</tt> and <tt>high</tt>, inclusive:<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *   SortedMap&lt;String, V&gt; sub = m.subMap(low, high+"\0");</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * A similar technique can be used to generate an <i>open range</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * (which contains neither endpoint).  The following idiom obtains a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * view containing all of the key-value mappings in <tt>m</tt> whose keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * are between <tt>low</tt> and <tt>high</tt>, exclusive:<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *   SortedMap&lt;String, V&gt; sub = m.subMap(low+"\0", high);</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * <p>This interface is a member of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * Java Collections Framework</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * @param <K> the type of keys maintained by this map
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @param <V> the type of mapped values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * @author  Josh Bloch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * @see Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * @see TreeMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * @see SortedSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * @see Comparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * @see Comparable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * @see Collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * @see ClassCastException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
public interface SortedMap<K,V> extends Map<K,V> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Returns the comparator used to order the keys in this map, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * <tt>null</tt> if this map uses the {@linkplain Comparable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * natural ordering} of its keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @return the comparator used to order the keys in this map,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *         or <tt>null</tt> if this map uses the natural ordering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *         of its keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    Comparator<? super K> comparator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Returns a view of the portion of this map whose keys range from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive.  (If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * is empty.)  The returned map is backed by this map, so changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * in the returned map are reflected in this map, and vice-versa.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * The returned map supports all optional map operations that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * map supports.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * on an attempt to insert a key outside its range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param fromKey low endpoint (inclusive) of the keys in the returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param toKey high endpoint (exclusive) of the keys in the returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @return a view of the portion of this map whose keys range from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *         <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @throws ClassCastException if <tt>fromKey</tt> and <tt>toKey</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     *         cannot be compared to one another using this map's comparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *         (or, if the map has no comparator, using natural ordering).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *         Implementations may, but are not required to, throw this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *         exception if <tt>fromKey</tt> or <tt>toKey</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *         cannot be compared to keys currently in the map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *         is null and this map does not permit null keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @throws IllegalArgumentException if <tt>fromKey</tt> is greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *         <tt>toKey</tt>; or if this map itself has a restricted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *         range, and <tt>fromKey</tt> or <tt>toKey</tt> lies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *         outside the bounds of the range
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    SortedMap<K,V> subMap(K fromKey, K toKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * Returns a view of the portion of this map whose keys are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * strictly less than <tt>toKey</tt>.  The returned map is backed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * by this map, so changes in the returned map are reflected in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * this map, and vice-versa.  The returned map supports all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * optional map operations that this map supports.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * on an attempt to insert a key outside its range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @param toKey high endpoint (exclusive) of the keys in the returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @return a view of the portion of this map whose keys are strictly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *         less than <tt>toKey</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @throws ClassCastException if <tt>toKey</tt> is not compatible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *         with this map's comparator (or, if the map has no comparator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *         if <tt>toKey</tt> does not implement {@link Comparable}).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *         Implementations may, but are not required to, throw this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *         exception if <tt>toKey</tt> cannot be compared to keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *         currently in the map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @throws NullPointerException if <tt>toKey</tt> is null and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *         this map does not permit null keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @throws IllegalArgumentException if this map itself has a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *         restricted range, and <tt>toKey</tt> lies outside the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *         bounds of the range
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    SortedMap<K,V> headMap(K toKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * Returns a view of the portion of this map whose keys are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * greater than or equal to <tt>fromKey</tt>.  The returned map is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * backed by this map, so changes in the returned map are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * reflected in this map, and vice-versa.  The returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * supports all optional map operations that this map supports.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * on an attempt to insert a key outside its range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @param fromKey low endpoint (inclusive) of the keys in the returned map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @return a view of the portion of this map whose keys are greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *         than or equal to <tt>fromKey</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @throws ClassCastException if <tt>fromKey</tt> is not compatible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *         with this map's comparator (or, if the map has no comparator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *         if <tt>fromKey</tt> does not implement {@link Comparable}).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *         Implementations may, but are not required to, throw this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *         exception if <tt>fromKey</tt> cannot be compared to keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *         currently in the map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @throws NullPointerException if <tt>fromKey</tt> is null and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *         this map does not permit null keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @throws IllegalArgumentException if this map itself has a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     *         restricted range, and <tt>fromKey</tt> lies outside the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *         bounds of the range
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    SortedMap<K,V> tailMap(K fromKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * Returns the first (lowest) key currently in this map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @return the first (lowest) key currently in this map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @throws NoSuchElementException if this map is empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    K firstKey();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * Returns the last (highest) key currently in this map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @return the last (highest) key currently in this map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @throws NoSuchElementException if this map is empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    K lastKey();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Returns a {@link Set} view of the keys contained in this map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * The set's iterator returns the keys in ascending order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * The set is backed by the map, so changes to the map are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * reflected in the set, and vice-versa.  If the map is modified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * while an iteration over the set is in progress (except through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * the iterator's own <tt>remove</tt> operation), the results of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * the iteration are undefined.  The set supports element removal,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * which removes the corresponding mapping from the map, via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * operations.  It does not support the <tt>add</tt> or <tt>addAll</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @return a set view of the keys contained in this map, sorted in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *         ascending order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    Set<K> keySet();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * Returns a {@link Collection} view of the values contained in this map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * The collection's iterator returns the values in ascending order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * of the corresponding keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * The collection is backed by the map, so changes to the map are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * reflected in the collection, and vice-versa.  If the map is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * modified while an iteration over the collection is in progress
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * (except through the iterator's own <tt>remove</tt> operation),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * the results of the iteration are undefined.  The collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * supports element removal, which removes the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * mapping from the map, via the <tt>Iterator.remove</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * <tt>Collection.remove</tt>, <tt>removeAll</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * <tt>retainAll</tt> and <tt>clear</tt> operations.  It does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * support the <tt>add</tt> or <tt>addAll</tt> operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @return a collection view of the values contained in this map,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *         sorted in ascending key order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    Collection<V> values();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * Returns a {@link Set} view of the mappings contained in this map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * The set's iterator returns the entries in ascending key order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * The set is backed by the map, so changes to the map are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * reflected in the set, and vice-versa.  If the map is modified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * while an iteration over the set is in progress (except through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * the iterator's own <tt>remove</tt> operation, or through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * <tt>setValue</tt> operation on a map entry returned by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * iterator) the results of the iteration are undefined.  The set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * supports element removal, which removes the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * mapping from the map, via the <tt>Iterator.remove</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * <tt>clear</tt> operations.  It does not support the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * <tt>add</tt> or <tt>addAll</tt> operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @return a set view of the mappings contained in this map,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *         sorted in ascending key order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    Set<Map.Entry<K, V>> entrySet();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
}