public class BucketizedHashtable extends Object implements Cloneable, Map, Serializable
Constructor and Description |
---|
BucketizedHashtable()
Constructs a new, empty BucketizedHashtable with the default bucket
size 11, default initial capacity (11 * bucketSize)
and default load factor 0.75.
|
BucketizedHashtable(int bucketSize)
Constructs a new, empty BucketizedHashtable with the specified
bucket size, default initial capacity (11 * bucketSize) and
default load factor 0.75.
|
BucketizedHashtable(int bucketSize,
int initialCapacity)
Constructs a new, empty BucketizedHashtable with the specified
bucket size, initial capacity and default load factor 0.75.
|
BucketizedHashtable(int bucketSize,
int initialCapacity,
float loadFactor)
Constructs a new, empty BucketizedHashtable with the specified
bucket size, initial capacity and load factor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this BucketizedHashtable so that it contains no key.
|
Object |
clone()
Creates and returns a shallow copy of this object.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set |
entrySet()
The return set is backed by the map, so changes to the map are
reflected in the set, and vice-versa.
|
boolean |
equals(Object o)
Compares the specified object with this map for equality.
|
Object |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set |
keySet()
The return set is backed by the map, so changes to the map are
reflected in the set, and vice-versa.
|
Object |
put(Object key,
Object value)
Maps the specified
key to the specified
value in this hashtable. |
void |
putAll(Map t) |
Object |
remove(Object key)
Remove the key and its corresponding value.
|
int |
size() |
String |
toString() |
Collection |
values()
The return collection is backed by the map, so changes to the map
are reflected in the collection, and vice-versa.
|
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public BucketizedHashtable(int bucketSize, int initialCapacity, float loadFactor)
bucketSize
- the number of buckets used for hashinginitialCapacity
- the initial capacity of BucketizedHashtableloadFactor
- the load factor of hashtablepublic BucketizedHashtable(int bucketSize, int initialCapacity)
bucketSize
- the number of buckets used for hashinginitialCapacity
- the initial capacity of hashtablepublic BucketizedHashtable(int bucketSize)
bucketSize
- the number of buckets used for hashingpublic BucketizedHashtable()
public Object put(Object key, Object value)
key
to the specified
value
in this hashtable. Neither the key nor the
value can be null
. public void putAll(Map t)
public boolean containsKey(Object key)
containsKey
in interface Map
key
- possible keypublic boolean containsValue(Object value)
containsValue
in interface Map
value
- possible valuepublic int size()
public int hashCode()
public boolean isEmpty()
public void clear()
public Set entrySet()
entrySet
in interface Map
UnsupportedOperationException
- when bucketSize is greater onepublic Set keySet()
keySet
in interface Map
UnsupportedOperationException
- when bucketSize is greater onepublic Collection values()
values
in interface Map
UnsupportedOperationException
- when bucketSize is greater onepublic boolean equals(Object o)
public Object clone()
Copyright © 2021. All rights reserved.