rt/emul/compact/src/main/java/java/util/concurrent/ConcurrentNavigableMap.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 19 Mar 2016 10:46:31 +0100
branchjdk7-b147
changeset 1890 212417b74b72
permissions -rw-r--r--
Bringing in all concurrent package from JDK7-b147
jaroslav@1890
     1
/*
jaroslav@1890
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@1890
     3
 *
jaroslav@1890
     4
 * This code is free software; you can redistribute it and/or modify it
jaroslav@1890
     5
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@1890
     6
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@1890
     7
 * particular file as subject to the "Classpath" exception as provided
jaroslav@1890
     8
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@1890
     9
 *
jaroslav@1890
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@1890
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@1890
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@1890
    13
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@1890
    14
 * accompanied this code).
jaroslav@1890
    15
 *
jaroslav@1890
    16
 * You should have received a copy of the GNU General Public License version
jaroslav@1890
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@1890
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@1890
    19
 *
jaroslav@1890
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@1890
    21
 * or visit www.oracle.com if you need additional information or have any
jaroslav@1890
    22
 * questions.
jaroslav@1890
    23
 */
jaroslav@1890
    24
jaroslav@1890
    25
/*
jaroslav@1890
    26
 * This file is available under and governed by the GNU General Public
jaroslav@1890
    27
 * License version 2 only, as published by the Free Software Foundation.
jaroslav@1890
    28
 * However, the following notice accompanied the original version of this
jaroslav@1890
    29
 * file:
jaroslav@1890
    30
 *
jaroslav@1890
    31
 * Written by Doug Lea with assistance from members of JCP JSR-166
jaroslav@1890
    32
 * Expert Group and released to the public domain, as explained at
jaroslav@1890
    33
 * http://creativecommons.org/publicdomain/zero/1.0/
jaroslav@1890
    34
 */
jaroslav@1890
    35
jaroslav@1890
    36
package java.util.concurrent;
jaroslav@1890
    37
import java.util.*;
jaroslav@1890
    38
jaroslav@1890
    39
/**
jaroslav@1890
    40
 * A {@link ConcurrentMap} supporting {@link NavigableMap} operations,
jaroslav@1890
    41
 * and recursively so for its navigable sub-maps.
jaroslav@1890
    42
 *
jaroslav@1890
    43
 * <p>This interface is a member of the
jaroslav@1890
    44
 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
jaroslav@1890
    45
 * Java Collections Framework</a>.
jaroslav@1890
    46
 *
jaroslav@1890
    47
 * @author Doug Lea
jaroslav@1890
    48
 * @param <K> the type of keys maintained by this map
jaroslav@1890
    49
 * @param <V> the type of mapped values
jaroslav@1890
    50
 * @since 1.6
jaroslav@1890
    51
 */
jaroslav@1890
    52
public interface ConcurrentNavigableMap<K,V>
jaroslav@1890
    53
    extends ConcurrentMap<K,V>, NavigableMap<K,V>
jaroslav@1890
    54
{
jaroslav@1890
    55
    /**
jaroslav@1890
    56
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    57
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    58
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    59
     */
jaroslav@1890
    60
    ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
jaroslav@1890
    61
                                       K toKey,   boolean toInclusive);
jaroslav@1890
    62
jaroslav@1890
    63
    /**
jaroslav@1890
    64
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    65
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    66
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    67
     */
jaroslav@1890
    68
    ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive);
jaroslav@1890
    69
jaroslav@1890
    70
jaroslav@1890
    71
    /**
jaroslav@1890
    72
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    73
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    74
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    75
     */
jaroslav@1890
    76
    ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive);
jaroslav@1890
    77
jaroslav@1890
    78
    /**
jaroslav@1890
    79
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    80
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    81
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    82
     */
jaroslav@1890
    83
    ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey);
jaroslav@1890
    84
jaroslav@1890
    85
    /**
jaroslav@1890
    86
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    87
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    88
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    89
     */
jaroslav@1890
    90
    ConcurrentNavigableMap<K,V> headMap(K toKey);
jaroslav@1890
    91
jaroslav@1890
    92
    /**
jaroslav@1890
    93
     * @throws ClassCastException       {@inheritDoc}
jaroslav@1890
    94
     * @throws NullPointerException     {@inheritDoc}
jaroslav@1890
    95
     * @throws IllegalArgumentException {@inheritDoc}
jaroslav@1890
    96
     */
jaroslav@1890
    97
    ConcurrentNavigableMap<K,V> tailMap(K fromKey);
jaroslav@1890
    98
jaroslav@1890
    99
    /**
jaroslav@1890
   100
     * Returns a reverse order view of the mappings contained in this map.
jaroslav@1890
   101
     * The descending map is backed by this map, so changes to the map are
jaroslav@1890
   102
     * reflected in the descending map, and vice-versa.
jaroslav@1890
   103
     *
jaroslav@1890
   104
     * <p>The returned map has an ordering equivalent to
jaroslav@1890
   105
     * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
jaroslav@1890
   106
     * The expression {@code m.descendingMap().descendingMap()} returns a
jaroslav@1890
   107
     * view of {@code m} essentially equivalent to {@code m}.
jaroslav@1890
   108
     *
jaroslav@1890
   109
     * @return a reverse order view of this map
jaroslav@1890
   110
     */
jaroslav@1890
   111
    ConcurrentNavigableMap<K,V> descendingMap();
jaroslav@1890
   112
jaroslav@1890
   113
    /**
jaroslav@1890
   114
     * Returns a {@link NavigableSet} view of the keys contained in this map.
jaroslav@1890
   115
     * The set's iterator returns the keys in ascending order.
jaroslav@1890
   116
     * The set is backed by the map, so changes to the map are
jaroslav@1890
   117
     * reflected in the set, and vice-versa.  The set supports element
jaroslav@1890
   118
     * removal, which removes the corresponding mapping from the map,
jaroslav@1890
   119
     * via the {@code Iterator.remove}, {@code Set.remove},
jaroslav@1890
   120
     * {@code removeAll}, {@code retainAll}, and {@code clear}
jaroslav@1890
   121
     * operations.  It does not support the {@code add} or {@code addAll}
jaroslav@1890
   122
     * operations.
jaroslav@1890
   123
     *
jaroslav@1890
   124
     * <p>The view's {@code iterator} is a "weakly consistent" iterator
jaroslav@1890
   125
     * that will never throw {@link ConcurrentModificationException},
jaroslav@1890
   126
     * and guarantees to traverse elements as they existed upon
jaroslav@1890
   127
     * construction of the iterator, and may (but is not guaranteed to)
jaroslav@1890
   128
     * reflect any modifications subsequent to construction.
jaroslav@1890
   129
     *
jaroslav@1890
   130
     * @return a navigable set view of the keys in this map
jaroslav@1890
   131
     */
jaroslav@1890
   132
    public NavigableSet<K> navigableKeySet();
jaroslav@1890
   133
jaroslav@1890
   134
    /**
jaroslav@1890
   135
     * Returns a {@link NavigableSet} view of the keys contained in this map.
jaroslav@1890
   136
     * The set's iterator returns the keys in ascending order.
jaroslav@1890
   137
     * The set is backed by the map, so changes to the map are
jaroslav@1890
   138
     * reflected in the set, and vice-versa.  The set supports element
jaroslav@1890
   139
     * removal, which removes the corresponding mapping from the map,
jaroslav@1890
   140
     * via the {@code Iterator.remove}, {@code Set.remove},
jaroslav@1890
   141
     * {@code removeAll}, {@code retainAll}, and {@code clear}
jaroslav@1890
   142
     * operations.  It does not support the {@code add} or {@code addAll}
jaroslav@1890
   143
     * operations.
jaroslav@1890
   144
     *
jaroslav@1890
   145
     * <p>The view's {@code iterator} is a "weakly consistent" iterator
jaroslav@1890
   146
     * that will never throw {@link ConcurrentModificationException},
jaroslav@1890
   147
     * and guarantees to traverse elements as they existed upon
jaroslav@1890
   148
     * construction of the iterator, and may (but is not guaranteed to)
jaroslav@1890
   149
     * reflect any modifications subsequent to construction.
jaroslav@1890
   150
     *
jaroslav@1890
   151
     * <p>This method is equivalent to method {@code navigableKeySet}.
jaroslav@1890
   152
     *
jaroslav@1890
   153
     * @return a navigable set view of the keys in this map
jaroslav@1890
   154
     */
jaroslav@1890
   155
    NavigableSet<K> keySet();
jaroslav@1890
   156
jaroslav@1890
   157
    /**
jaroslav@1890
   158
     * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
jaroslav@1890
   159
     * The set's iterator returns the keys in descending order.
jaroslav@1890
   160
     * The set is backed by the map, so changes to the map are
jaroslav@1890
   161
     * reflected in the set, and vice-versa.  The set supports element
jaroslav@1890
   162
     * removal, which removes the corresponding mapping from the map,
jaroslav@1890
   163
     * via the {@code Iterator.remove}, {@code Set.remove},
jaroslav@1890
   164
     * {@code removeAll}, {@code retainAll}, and {@code clear}
jaroslav@1890
   165
     * operations.  It does not support the {@code add} or {@code addAll}
jaroslav@1890
   166
     * operations.
jaroslav@1890
   167
     *
jaroslav@1890
   168
     * <p>The view's {@code iterator} is a "weakly consistent" iterator
jaroslav@1890
   169
     * that will never throw {@link ConcurrentModificationException},
jaroslav@1890
   170
     * and guarantees to traverse elements as they existed upon
jaroslav@1890
   171
     * construction of the iterator, and may (but is not guaranteed to)
jaroslav@1890
   172
     * reflect any modifications subsequent to construction.
jaroslav@1890
   173
     *
jaroslav@1890
   174
     * @return a reverse order navigable set view of the keys in this map
jaroslav@1890
   175
     */
jaroslav@1890
   176
    public NavigableSet<K> descendingKeySet();
jaroslav@1890
   177
}