org.apache.avalon.excalibur.collections
Class BucketMap

java.lang.Object
  |
  +--org.apache.avalon.excalibur.collections.BucketMap
All Implemented Interfaces:
Map

Deprecated. use org.apache.commons.collections.StaticBucketMap instead

public final class BucketMap
extends Object
implements Map

A BucketMap is an efficient thread-safe implementation of the java.util.Map. The map supports get, put, and contains methods most efficiently. The other methods are supported, but are ver inneficient compared to other java.util.Map implementations.

Since:
4.0
Version:
CVS $Revision: 1.4 $ $Date: 2003/03/22 12:46:22 $
Author:
Berin Loritsch, Gerhard Froehlich

Constructor Summary
BucketMap()
          Deprecated. Initializes the map with the default number of buckets.
BucketMap(int numBuckets)
          Deprecated. Initializes the map with a specified number of buckets.
 
Method Summary
 void clear()
          Deprecated. Removes all the entries from the Map.
 boolean containsKey(Object key)
          Deprecated. Checks to see if the provided key exists in the Map.
 boolean containsValue(Object value)
          Deprecated. Checks to see if a value exists.
 Set entrySet()
          Deprecated. Obtain a Set for the entries.
 Object get(Object key)
          Deprecated. Get an object from the Map by the key
 boolean isEmpty()
          Deprecated. Tests if the Map is empty.
 Set keySet()
          Deprecated. Obtain a Set for the keys.
 Object put(Object key, Object value)
          Deprecated. Put a reference in the Map.
 void putAll(Map other)
          Deprecated. Add all the contents of one Map into this one.
 Object remove(Object key)
          Deprecated. Removes the object from the Map based on the key.
 int size()
          Deprecated. Returns the current number of key, value pairs.
 Collection values()
          Deprecated. Obtain a Set for the values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

BucketMap

public BucketMap()
Deprecated. 
Initializes the map with the default number of buckets.


BucketMap

public BucketMap(int numBuckets)
Deprecated. 
Initializes the map with a specified number of buckets. The number of buckets is never below 17, and is always an odd number (BucketMap ensures this). The number of buckets is inversely proportional to the chances for thread contention. The fewer buckets, the more chances for thread contention. The more buckets the fewer chances for thread contention.

Method Detail

keySet

public Set keySet()
Deprecated. 
Obtain a Set for the keys. This operation crosses bucket boundaries, so it is less efficient, and greatly increases the chance for thread contention.

Specified by:
keySet in interface Map

size

public int size()
Deprecated. 
Returns the current number of key, value pairs.

Specified by:
size in interface Map

put

public Object put(Object key,
                  Object value)
Deprecated. 
Put a reference in the Map.

Specified by:
put in interface Map

get

public Object get(Object key)
Deprecated. 
Get an object from the Map by the key

Specified by:
get in interface Map

containsKey

public boolean containsKey(Object key)
Deprecated. 
Checks to see if the provided key exists in the Map.

Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Deprecated. 
Checks to see if a value exists. This operation crosses bucket boundaries, so it is less efficient, and greatly increases the chance for thread contention.

Specified by:
containsValue in interface Map

values

public Collection values()
Deprecated. 
Obtain a Set for the values. This operation crosses bucket boundaries, so it is less efficient, and greatly increases the chance for thread contention.

Specified by:
values in interface Map

entrySet

public Set entrySet()
Deprecated. 
Obtain a Set for the entries. This operation crosses bucket boundaries, so it is less efficient, and greatly increases the chance for thread contention.

Specified by:
entrySet in interface Map

putAll

public void putAll(Map other)
Deprecated. 
Add all the contents of one Map into this one.

Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Deprecated. 
Removes the object from the Map based on the key.

Specified by:
remove in interface Map

isEmpty

public final boolean isEmpty()
Deprecated. 
Tests if the Map is empty.

Specified by:
isEmpty in interface Map

clear

public final void clear()
Deprecated. 
Removes all the entries from the Map.

Specified by:
clear in interface Map


Copyright © 2000-2003 Apache Jakarta Project. All Rights Reserved.