ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/extra166y/CustomConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/extra166y/CustomConcurrentHashMap.java (file contents):
Revision 1.31 by jsr166, Tue Feb 5 17:39:56 2013 UTC vs.
Revision 1.36 by jsr166, Sun Jan 18 20:17:32 2015 UTC

# Line 5 | Line 5
5   */
6  
7   package extra166y;
8 +
9   import java.lang.ref.*;
10   import java.lang.reflect.*;
11   import java.io.*;
# Line 110 | Line 111 | import sun.misc.Unsafe;
111   * @param <K> the type of keys maintained by this map
112   * @param <V> the type of mapped values
113   */
114 < public class CustomConcurrentHashMap<K, V> extends AbstractMap<K, V>
115 <    implements ConcurrentMap<K, V>, Serializable {
114 > public class CustomConcurrentHashMap<K,V> extends AbstractMap<K,V>
115 >    implements ConcurrentMap<K,V>, Serializable {
116      private static final long serialVersionUID = 7249069246764182397L;
117  
118      /*
# Line 224 | Line 225 | public class CustomConcurrentHashMap<K,
225  
226      /**
227       * A function computing a mapping from the given key to a value,
228 <     *  or {@code null} if there is no mapping.
228 >     * or {@code null} if there is no mapping.
229       */
230 <    public static interface MappingFunction<K, V> {
230 >    public static interface MappingFunction<K,V> {
231          /**
232           * Returns a value for the given key, or null if there is no
233           * mapping. If this function throws an (unchecked) exception,
# Line 245 | Line 246 | public class CustomConcurrentHashMap<K,
246      /**
247       * A function computing a new mapping from the given key and its
248       * current value to a new value, or {@code null} if there is
249 <     * no mapping
249 >     * no mapping.
250       */
251 <    public static interface RemappingFunction<K, V> {
251 >    public static interface RemappingFunction<K,V> {
252          /**
253           * Returns a new value for the given key and its current, or
254           * null if there is no mapping.
# Line 679 | Line 680 | public class CustomConcurrentHashMap<K,
680       * Returns {@code true} if this map contains a key equivalent to
681       * the given key with respect to this map's key Equivalence.
682       *
683 <     * @param  key   possible key
683 >     * @param  key possible key
684       * @return {@code true} if this map contains the specified key
685       * @throws NullPointerException if the specified key is null
686       */
# Line 697 | Line 698 | public class CustomConcurrentHashMap<K,
698       * key with respect to this map's key Equivalence, or {@code null}
699       * if no such mapping exists.
700       *
701 <     * @param  key   possible key
702 <     * @return the value associated with the key or {@code null} if
703 <     * there is no mapping.
701 >     * @param  key possible key
702 >     * @return the value associated with the key, or {@code null} if
703 >     * there is no mapping
704       * @throws NullPointerException if the specified key is null
705       */
706      public V get(Object key) {
# Line 1090 | Line 1091 | public class CustomConcurrentHashMap<K,
1091       * @param mappingFunction the function to compute a value
1092       * @return the current (existing or computed) value associated with
1093       *         the specified key, or {@code null} if the computation
1094 <     *         returned {@code null}.
1094 >     *         returned {@code null}
1095       * @throws NullPointerException if the specified key or mappingFunction
1096 <     *         is null,
1096 >     *         is null
1097       * @throws RuntimeException or Error if the mappingFunction does so,
1098 <     *         in which case the mapping is left unestablished.
1098 >     *         in which case the mapping is left unestablished
1099       */
1100      public V computeIfAbsent(K key, MappingFunction<? super K, ? extends V> mappingFunction) {
1101          if (key == null || mappingFunction == null)
# Line 1165 | Line 1166 | public class CustomConcurrentHashMap<K,
1166       * @return the updated value or
1167       *         {@code null} if the computation returned {@code null}
1168       * @throws NullPointerException if the specified key or remappingFunction
1169 <     *         is null,
1169 >     *         is null
1170       * @throws RuntimeException or Error if the remappingFunction does so,
1171       *         in which case the mapping is left in its previous state
1172       */
# Line 1720 | Line 1721 | public class CustomConcurrentHashMap<K,
1721       * to {@link java.lang.ref.Reference} constructors to arrange
1722       * removal of reclaimed nodes from maps via a background thread.
1723       * @return the reference queue associated with the background
1724 <     * cleanup thread.
1724 >     * cleanup thread
1725       */
1726      static ReferenceQueue<Object> getReclamationQueue() {
1727          ReferenceQueue<Object> q = refQueue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines