com.starbase.util.collections
Class SimpleHashMap

java.lang.Object
  |
  +--com.starbase.util.collections.SimpleHashMap
All Implemented Interfaces:
Map

public class SimpleHashMap
extends java.lang.Object
implements Map

A simple implementation of the Map interface that uses a Hashtable as its underlying implementation. This class does support null values.


Nested Class Summary
 
Nested classes inherited from class com.starbase.util.collections.Map
Map.Entry
 
Constructor Summary
SimpleHashMap()
          Constructs a new SimpleHashMap.
SimpleHashMap(int initialCapacity)
          Constructs a new SimpleHashMap with the specified initial capacity and a load factor of 0.75.
SimpleHashMap(int initialCapacity, float loadFactor)
          Constructs a new SimpleHashMap with the specified initial capacity and load factor.
 
Method Summary
 void clear()
          Removes all mappings stored in this map (optional operation).
 boolean containsKey(java.lang.Object key)
          Returns true if the specified key is contained in this map.
 boolean containsValue(java.lang.Object value)
          Returns true if the specified value is contained in this map.
 Set entrySet()
          This is currently not implemented.
 java.lang.Object get(java.lang.Object key)
          Returns the value for the specified key from the map.
 boolean isEmpty()
          Return true if the map is empty.
 Set keySet()
          This is currently not implemented.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Asscociates the specified value with the specified key.
 void putAll(Map map)
          This operation is unsupported and will throw an exception if called.
 java.lang.Object remove(java.lang.Object key)
          Removes the key from this map.
 int size()
          Return the number of entries in this map.
 Collection values()
          This is currently not implemented.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.starbase.util.collections.Map
equals, hashCode
 

Constructor Detail

SimpleHashMap

public SimpleHashMap()
Constructs a new SimpleHashMap.


SimpleHashMap

public SimpleHashMap(int initialCapacity)
Constructs a new SimpleHashMap with the specified initial capacity and a load factor of 0.75.

Parameters:
initialCapacity - the initial capacity of this map.

SimpleHashMap

public SimpleHashMap(int initialCapacity,
                     float loadFactor)
Constructs a new SimpleHashMap with the specified initial capacity and load factor. The load factor specifies how full the underlying hash table has to get before its capacity is automatically increased.

Parameters:
initialCapacity - the initial capacity of this map.
loadFactor - the load factor for the underlying hashtable.
Method Detail

size

public int size()
Return the number of entries in this map.

Specified by:
size in interface Map
Returns:
the number of entries in this map.

isEmpty

public boolean isEmpty()
Return true if the map is empty.

Specified by:
isEmpty in interface Map
Returns:
true if the map is empty.

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if the specified key is contained in this map.

Specified by:
containsKey in interface Map
Parameters:
key - the key being checked for in this map.
Returns:
true if the specified key is contained in this map.

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if the specified value is contained in this map. That is ther must be an entry in the map for which a key maps to this value.

Specified by:
containsValue in interface Map
Parameters:
value - the value being checked for in this map
Returns:
true if the specified value is contained in this map.

get

public java.lang.Object get(java.lang.Object key)
Returns the value for the specified key from the map. This may return null.

Specified by:
get in interface Map
Parameters:
key - the key used for lookup in this map.
Returns:
the value for the specified key from the map.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Asscociates the specified value with the specified key. The value is allowed to be null.

Specified by:
put in interface Map
Parameters:
key - the key with which the value is associated
value - the value associated with the key (may be null)
Returns:
the previously associated value with the specified key or null if there was no mapping for the key

remove

public java.lang.Object remove(java.lang.Object key)
Removes the key from this map. May return null.

Specified by:
remove in interface Map
Parameters:
key - the key to be removed
Returns:
the value that was associated with the key (may return null)

putAll

public void putAll(Map map)
This operation is unsupported and will throw an exception if called.

Specified by:
putAll in interface Map
Parameters:
map - the mappings to be stored in this map

clear

public void clear()
Removes all mappings stored in this map (optional operation).

Specified by:
clear in interface Map

keySet

public Set keySet()
This is currently not implemented.

Specified by:
keySet in interface Map
Returns:
nothing, always throws an exception
Throws:
UnsupportedOperationException - always

values

public Collection values()
This is currently not implemented.

Specified by:
values in interface Map
Returns:
nothing, always throws an exception
Throws:
UnsupportedOperationException - always

entrySet

public Set entrySet()
This is currently not implemented.

Specified by:
entrySet in interface Map
Returns:
nothing, always throws an exception
Throws:
UnsupportedOperationException - always


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.