org.eclipse.core.internal.utils
Class ObjectMap

java.lang.Object
  extended by org.eclipse.core.internal.utils.ObjectMap
All Implemented Interfaces:
java.util.Map, IStringPoolParticipant

public class ObjectMap
extends java.lang.Object
implements java.util.Map, IStringPoolParticipant

A specialized map implementation that is optimized for a small set of object keys. Implemented as a single array that alternates keys and values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ObjectMap()
          Creates a new object map of default size
ObjectMap(int initialCapacity)
          Creates a new object map.
ObjectMap(java.util.Map map)
          Creates a new object map of the same size as the given map and populate it with the key/attribute pairs found in the map.
 
Method Summary
 void clear()
           
 java.lang.Object clone()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object o)
          See Object#equals
 java.lang.Object get(java.lang.Object key)
           
 int hashCode()
          See Object#hashCode
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object key)
           
 void shareStrings(StringPool set)
          Instructs this participant to share its strings in the provided pool.
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectMap

public ObjectMap()
Creates a new object map of default size


ObjectMap

public ObjectMap(int initialCapacity)
Creates a new object map.

Parameters:
initialCapacity - The initial number of elements that will fit in the map.

ObjectMap

public ObjectMap(java.util.Map map)
Creates a new object map of the same size as the given map and populate it with the key/attribute pairs found in the map.

Parameters:
map - The entries in the given map will be added to the new map.
Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.Map
See Also:
Map.clear()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
See Also:
Map.containsKey(java.lang.Object)

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map
See Also:
Map.containsValue(java.lang.Object)

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
See Also:
This implementation does not conform properly to the specification in the Map interface. The returned collection will not be bound to this map and will not remain in sync with this map.

equals

public boolean equals(java.lang.Object o)
See Object#equals

Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.lang.Object

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
See Also:
Map.get(java.lang.Object)

hashCode

public int hashCode()
See Object#hashCode

Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
See Also:
Map.isEmpty()

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
See Also:
This implementation does not conform properly to the specification in the Map interface. The returned collection will not be bound to this map and will not remain in sync with this map.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
See Also:
Map.put(java.lang.Object, java.lang.Object)

putAll

public void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map
See Also:
Map.putAll(java.util.Map)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
See Also:
Map.remove(java.lang.Object)

size

public int size()
Specified by:
size in interface java.util.Map
See Also:
Map.size()

shareStrings

public void shareStrings(StringPool set)
Description copied from interface: IStringPoolParticipant
Instructs this participant to share its strings in the provided pool.

Specified by:
shareStrings in interface IStringPoolParticipant

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map
See Also:
This implementation does not conform properly to the specification in the Map interface. The returned collection will not be bound to this map and will not remain in sync with this map.