org.eclipse.emf.common.util
Interface EMap

All Superinterfaces:
Collection, EList, List
All Known Implementing Classes:
BasicEMap

public interface EMap
extends EList

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 noteable 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
          An internal interface implemented by the map view.
 
Method Summary
 boolean containsKey(Object key)
          Returns whether the key is associated with a value.
 boolean containsValue(Object value)
          Returns whether the value is associated with a key.
 Set entrySet()
          Returns a set view of the entries.
 Object get(Object key)
          Returns the value associated with the key.
 int indexOfKey(Object key)
          Returns the index in the list of the entry with the given key, or -1, if there is no such entry.
 Set keySet()
          Returns a set view of the keys of the entries.
 Map map()
          Returns a map view.
 Object put(Object key, Object value)
          Associates the key with the value and returns the value previously associated with the key, or null.
 void putAll(EMap map)
          Puts each Map.Entry of the given map into this one.
 void putAll(Map map)
          Puts each Map.Entry of the given map into this one.
 Object removeKey(Object key)
          Disassociates the key from its value, and returns the value formerly associated with the key.
 Collection 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

public Object get(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

public Object put(Object key,
                  Object 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

public void putAll(Map map)
Puts each Map.Entry of the given map into this one.

Parameters:
map - the map of entries.
See Also:
put(java.lang.Object, java.lang.Object)

putAll

public void putAll(EMap map)
Puts each Map.Entry of the given map into this one.

Parameters:
map - the map of entries.
See Also:
put(java.lang.Object, java.lang.Object)

indexOfKey

public int indexOfKey(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

public boolean containsKey(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

public boolean containsValue(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

public Object removeKey(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

public Map map()
Returns a map view.

Returns:
a map view.

entrySet

public Set entrySet()
Returns a set view of the entries.

Returns:
a set view of the entries.

keySet

public Set keySet()
Returns a set view of the keys of the entries.

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

values

public Collection values()
Returns a collection view the values of the entries.

Returns:
a collection view the values of the entries.

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