com.atlassian.util.concurrent
Class CopyOnWriteMaps

java.lang.Object
  extended by com.atlassian.util.concurrent.CopyOnWriteMaps

public class CopyOnWriteMaps
extends java.lang.Object

Static factory methods for creating CopyOnWriteMap and CopyOnWriteSortedMap instances.

Author:
Jed Wesley-Smith

Constructor Summary
CopyOnWriteMaps()
           
 
Method Summary
static
<K,V> CopyOnWriteMap<K,V>
newHashMap()
          Creates a new CopyOnWriteMap with an underlying HashMap.
static
<K,V> CopyOnWriteMap<K,V>
newHashMap(java.util.Map<? extends K,? extends V> map)
          Creates a new CopyOnWriteMap with an underlying HashMap using the supplied map as the initial values.
static
<K,V> CopyOnWriteMap<K,V>
newLinkedMap()
          Creates a new CopyOnWriteMap with an underlying LinkedHashMap.
static
<K,V> CopyOnWriteMap<K,V>
newLinkedMap(java.util.Map<? extends K,? extends V> map)
          Creates a new CopyOnWriteMap with an underlying LinkedHashMap using the supplied map as the initial values.
static
<K,V> CopyOnWriteSortedMap<K,V>
newTreeMap()
          Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap and the sort uses the key's natural order.
static
<K,V> CopyOnWriteSortedMap<K,V>
newTreeMap(java.util.Comparator<? super K> comparator)
          Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap.
static
<K,V> CopyOnWriteSortedMap<K,V>
newTreeMap(java.util.Map<? extends K,? extends V> map)
          Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap, the sort uses the key's natural order and the initial values are supplied.
static
<K,V> CopyOnWriteSortedMap<K,V>
newTreeMap(java.util.Map<? extends K,? extends V> map, java.util.Comparator<? super K> comparator)
          Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap, the sort uses the key's natural order and the initial values are supplied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyOnWriteMaps

public CopyOnWriteMaps()
Method Detail

newHashMap

public static <K,V> CopyOnWriteMap<K,V> newHashMap()
Creates a new CopyOnWriteMap with an underlying HashMap.


newHashMap

public static <K,V> CopyOnWriteMap<K,V> newHashMap(java.util.Map<? extends K,? extends V> map)
Creates a new CopyOnWriteMap with an underlying HashMap using the supplied map as the initial values.


newLinkedMap

public static <K,V> CopyOnWriteMap<K,V> newLinkedMap()
Creates a new CopyOnWriteMap with an underlying LinkedHashMap. Iterators for this map will be return elements in insertion order.


newLinkedMap

public static <K,V> CopyOnWriteMap<K,V> newLinkedMap(java.util.Map<? extends K,? extends V> map)
Creates a new CopyOnWriteMap with an underlying LinkedHashMap using the supplied map as the initial values. Iterators for this map will be return elements in insertion order.


newTreeMap

public static <K,V> CopyOnWriteSortedMap<K,V> newTreeMap()
Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap and the sort uses the key's natural order.


newTreeMap

public static <K,V> CopyOnWriteSortedMap<K,V> newTreeMap(java.util.Map<? extends K,? extends V> map)
Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap, the sort uses the key's natural order and the initial values are supplied.

Parameters:
the - map to use as the initial values.

newTreeMap

public static <K,V> CopyOnWriteSortedMap<K,V> newTreeMap(java.util.Comparator<? super K> comparator)
Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap.

Parameters:
the - Comparator to use for ordering the keys.

newTreeMap

public static <K,V> CopyOnWriteSortedMap<K,V> newTreeMap(java.util.Map<? extends K,? extends V> map,
                                                         java.util.Comparator<? super K> comparator)
Create a new CopyOnWriteSortedMap where the underlying map instances are TreeMap, the sort uses the key's natural order and the initial values are supplied.

Parameters:
map - to use as the initial values.
comparator - for ordering.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.