org.eclipse.emf.common.util
Interface EMap<K,V>

All Superinterfaces:
java.util.Collection<java.util.Map.Entry<K,V>>, EList<java.util.Map.Entry<K,V>>, java.lang.Iterable<java.util.Map.Entry<K,V>>, java.util.List<java.util.Map.Entry<K,V>>
All Known Implementing Classes:
BasicEMap, EcoreEMap, EcoreEMap.Unsettable, URIMappingRegistryImpl

public interface EMap<K,V>
extends EList<java.util.Map.Entry<K,V>>

A list of java.util.Map.Entry instances, i.e., entries, that supports a map() view as well as the full Map API, with the notable exception of Map.remove(Object). It's return type conflicts with that of Collection.remove(Object). The removeKey(Object) method may be used instead. The implementation of remove may delegate to removeKey for an object that is not an instance of Map.Entry.


Nested Class Summary
static interface EMap.InternalMapView<K,V>
          An internal interface implemented by the map view.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Returns whether the key is associated with a value.
 boolean containsValue(java.lang.Object value)
          Returns whether the value is associated with a key.
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
          Returns a set view of the entries.
 V get(java.lang.Object key)
          Returns the value associated with the key.
 int indexOfKey(java.lang.Object key)
          Returns the index in the list of the entry with the given key, or -1, if there is no such entry.
 java.util.Set<K> keySet()
          Returns a set view of the keys of the entries.
 java.util.Map<K,V> map()
          Returns a map view.
 V put(K key, V value)
          Associates the key with the value and returns the value previously associated with the key, or null.
 void putAll(EMap<? extends K,? extends V> map)
          Puts each Map.Entry of the given map into this one.
 void putAll(java.util.Map<? extends K,? extends V> map)
          Puts each Map.Entry of the given map into this one.
 V removeKey(java.lang.Object key)
          Disassociates the key from its value, and returns the value formerly associated with the key.
 java.util.Collection<V> values()
          Returns a collection view the values of the entries.
 
Methods inherited from interface org.eclipse.emf.common.util.EList
move, move
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Method Detail

get

V get(java.lang.Object key)
Returns the value associated with the key. The key, the value, or both may be null.

Parameters:
key - the key of the value.
Returns:
the value associated with the key.

put

V put(K key,
      V value)
Associates the key with the value and returns the value previously associated with the key, or null. The key, the value, or both may be null. Either the existing entry is updated, or a new entry is added to the end of the list.

Parameters:
key - the key of the value.
value - the value associated with the key.
Returns:
the value formerly associated with the key, or null.

putAll

void putAll(java.util.Map<? extends K,? extends V> map)
Puts each Map.Entry of the given map into this one.

Parameters:
map - the map of entries.
See Also:
put(K, V)

putAll

void putAll(EMap<? extends K,? extends V> map)
Puts each Map.Entry of the given map into this one.

Parameters:
map - the map of entries.
See Also:
put(K, V)

indexOfKey

int indexOfKey(java.lang.Object key)
Returns the index in the list of the entry with the given key, or -1, if there is no such entry.

Parameters:
key - a key.
Returns:
the index of the entry with the given key.

containsKey

boolean containsKey(java.lang.Object key)
Returns whether the key is associated with a value.

Parameters:
key - a key associated with a value.
Returns:
whether the key is associated with a value.

containsValue

boolean containsValue(java.lang.Object value)
Returns whether the value is associated with a key.

Parameters:
value - a value associated with a key.
Returns:
whether the value is associated with a key.

removeKey

V removeKey(java.lang.Object key)
Disassociates the key from its value, and returns the value formerly associated with the key. An entry is removed from the list, if the key is found.

Parameters:
key - the key of a value.
Returns:
the value formerly associated with the key.

map

java.util.Map<K,V> map()
Returns a map view.

Returns:
a map view.

entrySet

java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Returns a set view of the entries.

Returns:
a set view of the entries.

keySet

java.util.Set<K> keySet()
Returns a set view of the keys of the entries.

Returns:
a set view of the keys of the entries.

values

java.util.Collection<V> values()
Returns a collection view the values of the entries.

Returns:
a collection view the values of the entries.

Copyright 2001-2012 IBM Corporation and others.
All Rights Reserved.