|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
org.norther.tammi.acorn.util.ConcurrentAbstractMap
org.norther.tammi.acorn.util.ConcurrentReadMap
org.norther.tammi.acorn.util.OrderedHashMap
public class OrderedHashMap
Extends ConcurrentReadMap by implementing the
OrderedMap interface. Ordered Sets, Collections and Lists and
the corresponding Iterators returned by this implementation support removals
but not additions. Values can also be set but not keys.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.norther.tammi.acorn.util.ConcurrentAbstractMap |
|---|
ConcurrentAbstractMap.Entry |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.acorn.util.ConcurrentReadMap |
|---|
DEFAULT_CAPACITY, MAXIMUM_CAPACITY, MINIMUM_CAPACITY |
| Fields inherited from class org.norther.tammi.acorn.util.ConcurrentAbstractMap |
|---|
DEFAULT_LOAD_FACTOR |
| Constructor Summary | |
|---|---|
OrderedHashMap()
Constructs a new, empty map with a default capacity and load factor. |
|
OrderedHashMap(int capacity)
Constructs a new, empty map with the specified initial capacity and default load factor. |
|
OrderedHashMap(int capacity,
float factor)
Constructs a new, empty map with the specified initial capacity and the specified load factor. |
|
OrderedHashMap(Map map)
Constructs a new map with the same mappings as the given map. |
|
| Method Summary | |
|---|---|
boolean |
add(int index,
Object key,
Object value)
Associates the specified value with the specified key to the specified index in this map if not already mapped. |
void |
clear()
|
Object |
clone()
|
List |
entryList()
Returns an ordered list of mapped entries. |
Set |
entrySet()
Returns a collection view of the mappings contained in this map. |
Object |
get(int index)
Gets the indexed value in this map. |
Map.Entry |
getEntryAt(int index)
Gets the indexed entry in this map. |
Object |
getKeyAt(int index)
Gets the indexed key in this map. |
int |
indexOfKey(Object key)
Returns the index of the specified key, or -1 if not found. |
boolean |
isModifiable()
Checks whether this map is modifiable. |
List |
keyList()
Returns an ordered list of mapped keys. |
Set |
keySet()
Returns a set view of the keys contained in this map. |
Object |
put(int index,
Object key,
Object value)
Associates the specified value with the specified key to the specified index in this map. |
void |
putAll(Map map)
|
Object |
putIfAbsent(int index,
Object key,
Object value)
Associates the specified value with the specified key to the specified index in this map if not already mapped. |
protected Object |
putInternal(int index,
Object key,
Object value,
boolean r)
Puts the internal value with the specified key to the specified index in this map. |
protected Object |
putInternal(Object key,
Object value,
boolean r)
Puts the internal value mapped to the specified key. |
Object |
remove(int index)
Removes the indexed element in this map. |
protected Object |
removeInternal(Object key,
Object value)
Removes the internal mapping with the optional value. |
Object |
replace(int index,
Object value)
Replaces the indexed element in this map. |
List |
valueList()
Returns an ordered list of mapped values. |
Collection |
values()
Returns a collection view of the values contained in this map. |
| Methods inherited from class org.norther.tammi.acorn.util.ConcurrentReadMap |
|---|
capacity, containsKey, containsValue, getEntry, getInternal, getReadTable, getWriteTable, isEmpty, recordWrite, rehash, replaceInternal, setWriteTable, size |
| Methods inherited from class org.norther.tammi.acorn.util.ConcurrentAbstractMap |
|---|
add, capacity, contains, elements, get, hash, keys, put, putIfAbsent, remove, remove, replace, replace |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.acorn.util.OrderedMap |
|---|
add |
| Methods inherited from interface java.util.concurrent.ConcurrentMap |
|---|
putIfAbsent, remove, replace, replace |
| Methods inherited from interface java.util.Map |
|---|
containsKey, containsValue, equals, get, hashCode, isEmpty, put, remove, size |
| Constructor Detail |
|---|
public OrderedHashMap()
public OrderedHashMap(int capacity)
Note that the initial capacity will be rounded to the nearest power of two.
capacity - the initial capacity.
IllegalArgumentException - for negative values.
public OrderedHashMap(int capacity,
float factor)
Note that the initial capacity will be rounded to the nearest power of two.
capacity - the initial capacity.factor - the load factor of the map.
IllegalArgumentException - for negative values.public OrderedHashMap(Map map)
map - the map to copy.| Method Detail |
|---|
public Object clone()
clone in class ConcurrentReadMappublic boolean isModifiable()
OrderedMap
isModifiable in interface OrderedMappublic int indexOfKey(Object key)
OrderedMap
indexOfKey in interface OrderedMapkey - the key.
public Object getKeyAt(int index)
OrderedMap
getKeyAt in interface OrderedMapindex - the index.
public Object get(int index)
OrderedMap
get in interface OrderedMapindex - the index.
public Map.Entry getEntryAt(int index)
OrderedMap
getEntryAt in interface OrderedMapindex - the index.
public Object put(int index,
Object key,
Object value)
OrderedMap
put in interface OrderedMapindex - the index.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
public Object putIfAbsent(int index,
Object key,
Object value)
OrderedMap
putIfAbsent in interface OrderedMapindex - the index.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
public boolean add(int index,
Object key,
Object value)
OrderedMap
add in interface OrderedMapindex - the index.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
public Object replace(int index,
Object value)
OrderedMap
replace in interface OrderedMapindex - the index.value - the new value.
public Object remove(int index)
OrderedMap
remove in interface OrderedMapindex - the index.
public Set keySet()
ConcurrentAbstractMap
keySet in interface MapkeySet in interface OrderedMapkeySet in class ConcurrentAbstractMappublic List keyList()
OrderedMap
keyList in interface OrderedMappublic Collection values()
ConcurrentAbstractMap
values in interface Mapvalues in interface OrderedMapvalues in class ConcurrentAbstractMappublic List valueList()
OrderedMap
valueList in interface OrderedMappublic Set entrySet()
ConcurrentAbstractMap
entrySet in interface MapentrySet in interface OrderedMapentrySet in class ConcurrentAbstractMappublic List entryList()
OrderedMap
entryList in interface OrderedMappublic void putAll(Map map)
putAll in interface MapputAll in class ConcurrentReadMappublic void clear()
clear in interface Mapclear in class ConcurrentReadMap
protected Object putInternal(Object key,
Object value,
boolean r)
ConcurrentAbstractMap
putInternal in class ConcurrentReadMapkey - the key.value - the value.r - if true, replace an existing mapping.
protected Object removeInternal(Object key,
Object value)
ConcurrentAbstractMap
removeInternal in class ConcurrentReadMapkey - the key.value - the value.
protected Object putInternal(int index,
Object key,
Object value,
boolean r)
index - the index.key - the key.value - the value.r - if true, replace an existing mapping.
IndexOutOfBoundsException - if the index is out of range.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||