org.norther.tammi.acorn.util
Interface OrderedMap

All Superinterfaces:
ConcurrentMap, Map
All Known Implementing Classes:
Configuration, ModifiableMap, OrderedHashMap, UnmodifiableMap

public interface OrderedMap
extends ConcurrentMap

An extension to ConcurrentMap providing a key and entry sets and a value collection, as well as key, entry and value lists, maintaining the definition order of map entries.

Author:
Ilkka Priha

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
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.
 boolean add(Object key, Object value)
          Associates the specified value with the specified key at the end of this map if not already mapped.
 List entryList()
          Returns an ordered list of mapped entries.
 Set entrySet()
          Returns an ordered set of mapped entries.
 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 an ordered set of mapped keys.
 Object put(int index, Object key, Object value)
          Associates the specified value with the specified key to the specified index in this 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.
 Object remove(int index)
          Removes the indexed element in this map.
 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 an ordered collection of mapped values.
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, remove, replace, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size
 

Method Detail

isModifiable

boolean isModifiable()
Checks whether this map is modifiable.

Returns:
true for a modifiable map, false otherwise.

indexOfKey

int indexOfKey(Object key)
Returns the index of the specified key, or -1 if not found.

Parameters:
key - the key.
Returns:
the index of the key.

getKeyAt

Object getKeyAt(int index)
Gets the indexed key in this map.

Parameters:
index - the index.
Returns:
the indexed value.
Throws:
IndexOutOfBoundsException - if the index is out of range.

get

Object get(int index)
Gets the indexed value in this map.

Parameters:
index - the index.
Returns:
the indexed value.
Throws:
IndexOutOfBoundsException - if the index is out of range.

getEntryAt

Map.Entry getEntryAt(int index)
Gets the indexed entry in this map.

Parameters:
index - the index.
Returns:
the indexed entry.
Throws:
IndexOutOfBoundsException - if the index is out of range.

put

Object put(int index,
           Object key,
           Object value)
Associates the specified value with the specified key to the specified index in this map. Note that an existing key is not moved.

Parameters:
index - the index.
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
previous value associated with the specified key.
Throws:
IndexOutOfBoundsException - if the index is out of range.

putIfAbsent

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.

Parameters:
index - the index.
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
previous value associated with the specified key.

add

boolean add(Object key,
            Object value)
Associates the specified value with the specified key at the end of this map if not already mapped.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
true if added, false otherwise.

add

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.

Parameters:
index - the index.
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
true if added, false otherwise.

replace

Object replace(int index,
               Object value)
Replaces the indexed element in this map.

Parameters:
index - the index.
value - the new value.
Returns:
the replaced value.
Throws:
IndexOutOfBoundsException - if the index is out of range.

remove

Object remove(int index)
Removes the indexed element in this map.

Parameters:
index - the index.
Returns:
the removed value.
Throws:
IndexOutOfBoundsException - if the index is out of range.

keySet

Set keySet()
Returns an ordered set of mapped keys.

Specified by:
keySet in interface Map
Returns:
a set of keys.

values

Collection values()
Returns an ordered collection of mapped values.

Specified by:
values in interface Map
Returns:
a collection of values.

entrySet

Set entrySet()
Returns an ordered set of mapped entries.

Specified by:
entrySet in interface Map
Returns:
a set of entries.

keyList

List keyList()
Returns an ordered list of mapped keys.

Returns:
a list of keys.

valueList

List valueList()
Returns an ordered list of mapped values.

Returns:
a list of values.

entryList

List entryList()
Returns an ordered list of mapped entries.

Returns:
a list of entries.


Copyright © 2004 The Norther Organization. All rights reserved.