rt/emul/compact/src/main/java/java/util/concurrent/ConcurrentNavigableMap.java
branchjdk7-b147
changeset 1890 212417b74b72
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rt/emul/compact/src/main/java/java/util/concurrent/ConcurrentNavigableMap.java	Sat Mar 19 10:46:31 2016 +0100
     1.3 @@ -0,0 +1,177 @@
     1.4 +/*
     1.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.6 + *
     1.7 + * This code is free software; you can redistribute it and/or modify it
     1.8 + * under the terms of the GNU General Public License version 2 only, as
     1.9 + * published by the Free Software Foundation.  Oracle designates this
    1.10 + * particular file as subject to the "Classpath" exception as provided
    1.11 + * by Oracle in the LICENSE file that accompanied this code.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + */
    1.27 +
    1.28 +/*
    1.29 + * This file is available under and governed by the GNU General Public
    1.30 + * License version 2 only, as published by the Free Software Foundation.
    1.31 + * However, the following notice accompanied the original version of this
    1.32 + * file:
    1.33 + *
    1.34 + * Written by Doug Lea with assistance from members of JCP JSR-166
    1.35 + * Expert Group and released to the public domain, as explained at
    1.36 + * http://creativecommons.org/publicdomain/zero/1.0/
    1.37 + */
    1.38 +
    1.39 +package java.util.concurrent;
    1.40 +import java.util.*;
    1.41 +
    1.42 +/**
    1.43 + * A {@link ConcurrentMap} supporting {@link NavigableMap} operations,
    1.44 + * and recursively so for its navigable sub-maps.
    1.45 + *
    1.46 + * <p>This interface is a member of the
    1.47 + * <a href="{@docRoot}/../technotes/guides/collections/index.html">
    1.48 + * Java Collections Framework</a>.
    1.49 + *
    1.50 + * @author Doug Lea
    1.51 + * @param <K> the type of keys maintained by this map
    1.52 + * @param <V> the type of mapped values
    1.53 + * @since 1.6
    1.54 + */
    1.55 +public interface ConcurrentNavigableMap<K,V>
    1.56 +    extends ConcurrentMap<K,V>, NavigableMap<K,V>
    1.57 +{
    1.58 +    /**
    1.59 +     * @throws ClassCastException       {@inheritDoc}
    1.60 +     * @throws NullPointerException     {@inheritDoc}
    1.61 +     * @throws IllegalArgumentException {@inheritDoc}
    1.62 +     */
    1.63 +    ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
    1.64 +                                       K toKey,   boolean toInclusive);
    1.65 +
    1.66 +    /**
    1.67 +     * @throws ClassCastException       {@inheritDoc}
    1.68 +     * @throws NullPointerException     {@inheritDoc}
    1.69 +     * @throws IllegalArgumentException {@inheritDoc}
    1.70 +     */
    1.71 +    ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive);
    1.72 +
    1.73 +
    1.74 +    /**
    1.75 +     * @throws ClassCastException       {@inheritDoc}
    1.76 +     * @throws NullPointerException     {@inheritDoc}
    1.77 +     * @throws IllegalArgumentException {@inheritDoc}
    1.78 +     */
    1.79 +    ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive);
    1.80 +
    1.81 +    /**
    1.82 +     * @throws ClassCastException       {@inheritDoc}
    1.83 +     * @throws NullPointerException     {@inheritDoc}
    1.84 +     * @throws IllegalArgumentException {@inheritDoc}
    1.85 +     */
    1.86 +    ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey);
    1.87 +
    1.88 +    /**
    1.89 +     * @throws ClassCastException       {@inheritDoc}
    1.90 +     * @throws NullPointerException     {@inheritDoc}
    1.91 +     * @throws IllegalArgumentException {@inheritDoc}
    1.92 +     */
    1.93 +    ConcurrentNavigableMap<K,V> headMap(K toKey);
    1.94 +
    1.95 +    /**
    1.96 +     * @throws ClassCastException       {@inheritDoc}
    1.97 +     * @throws NullPointerException     {@inheritDoc}
    1.98 +     * @throws IllegalArgumentException {@inheritDoc}
    1.99 +     */
   1.100 +    ConcurrentNavigableMap<K,V> tailMap(K fromKey);
   1.101 +
   1.102 +    /**
   1.103 +     * Returns a reverse order view of the mappings contained in this map.
   1.104 +     * The descending map is backed by this map, so changes to the map are
   1.105 +     * reflected in the descending map, and vice-versa.
   1.106 +     *
   1.107 +     * <p>The returned map has an ordering equivalent to
   1.108 +     * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
   1.109 +     * The expression {@code m.descendingMap().descendingMap()} returns a
   1.110 +     * view of {@code m} essentially equivalent to {@code m}.
   1.111 +     *
   1.112 +     * @return a reverse order view of this map
   1.113 +     */
   1.114 +    ConcurrentNavigableMap<K,V> descendingMap();
   1.115 +
   1.116 +    /**
   1.117 +     * Returns a {@link NavigableSet} view of the keys contained in this map.
   1.118 +     * The set's iterator returns the keys in ascending order.
   1.119 +     * The set is backed by the map, so changes to the map are
   1.120 +     * reflected in the set, and vice-versa.  The set supports element
   1.121 +     * removal, which removes the corresponding mapping from the map,
   1.122 +     * via the {@code Iterator.remove}, {@code Set.remove},
   1.123 +     * {@code removeAll}, {@code retainAll}, and {@code clear}
   1.124 +     * operations.  It does not support the {@code add} or {@code addAll}
   1.125 +     * operations.
   1.126 +     *
   1.127 +     * <p>The view's {@code iterator} is a "weakly consistent" iterator
   1.128 +     * that will never throw {@link ConcurrentModificationException},
   1.129 +     * and guarantees to traverse elements as they existed upon
   1.130 +     * construction of the iterator, and may (but is not guaranteed to)
   1.131 +     * reflect any modifications subsequent to construction.
   1.132 +     *
   1.133 +     * @return a navigable set view of the keys in this map
   1.134 +     */
   1.135 +    public NavigableSet<K> navigableKeySet();
   1.136 +
   1.137 +    /**
   1.138 +     * Returns a {@link NavigableSet} view of the keys contained in this map.
   1.139 +     * The set's iterator returns the keys in ascending order.
   1.140 +     * The set is backed by the map, so changes to the map are
   1.141 +     * reflected in the set, and vice-versa.  The set supports element
   1.142 +     * removal, which removes the corresponding mapping from the map,
   1.143 +     * via the {@code Iterator.remove}, {@code Set.remove},
   1.144 +     * {@code removeAll}, {@code retainAll}, and {@code clear}
   1.145 +     * operations.  It does not support the {@code add} or {@code addAll}
   1.146 +     * operations.
   1.147 +     *
   1.148 +     * <p>The view's {@code iterator} is a "weakly consistent" iterator
   1.149 +     * that will never throw {@link ConcurrentModificationException},
   1.150 +     * and guarantees to traverse elements as they existed upon
   1.151 +     * construction of the iterator, and may (but is not guaranteed to)
   1.152 +     * reflect any modifications subsequent to construction.
   1.153 +     *
   1.154 +     * <p>This method is equivalent to method {@code navigableKeySet}.
   1.155 +     *
   1.156 +     * @return a navigable set view of the keys in this map
   1.157 +     */
   1.158 +    NavigableSet<K> keySet();
   1.159 +
   1.160 +    /**
   1.161 +     * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
   1.162 +     * The set's iterator returns the keys in descending order.
   1.163 +     * The set is backed by the map, so changes to the map are
   1.164 +     * reflected in the set, and vice-versa.  The set supports element
   1.165 +     * removal, which removes the corresponding mapping from the map,
   1.166 +     * via the {@code Iterator.remove}, {@code Set.remove},
   1.167 +     * {@code removeAll}, {@code retainAll}, and {@code clear}
   1.168 +     * operations.  It does not support the {@code add} or {@code addAll}
   1.169 +     * operations.
   1.170 +     *
   1.171 +     * <p>The view's {@code iterator} is a "weakly consistent" iterator
   1.172 +     * that will never throw {@link ConcurrentModificationException},
   1.173 +     * and guarantees to traverse elements as they existed upon
   1.174 +     * construction of the iterator, and may (but is not guaranteed to)
   1.175 +     * reflect any modifications subsequent to construction.
   1.176 +     *
   1.177 +     * @return a reverse order navigable set view of the keys in this map
   1.178 +     */
   1.179 +    public NavigableSet<K> descendingKeySet();
   1.180 +}