public class HashTable extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
HashTable.Entry
To manage collisions
|
Modifier and Type | Field and Description |
---|---|
protected int |
count
The number of entries
|
protected static int |
INITIAL_CAPACITY
The initial capacity
|
protected HashTable.Entry[] |
table
The underlying array
|
Constructor and Description |
---|
HashTable()
Creates a new table.
|
HashTable(HashTable t)
Creates a copy of the given HashTable object.
|
HashTable(int c)
Creates a new table.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the map.
|
Object |
get(Object key)
Gets the value of a variable
|
Object |
item(int index)
Returns the item at the given position.
|
Object |
key(int index)
Returns the key at the given position or null.
|
Object |
put(Object key,
Object value)
Sets a new value for the given variable
|
protected void |
rehash()
Rehash the table
|
Object |
remove(Object key)
Removes an entry from the table.
|
int |
size()
Returns the size of this table.
|
protected static final int INITIAL_CAPACITY
protected HashTable.Entry[] table
protected int count
public HashTable()
public HashTable(int c)
c
- The initial capacity.public HashTable(HashTable t)
t
- The table to copy.public int size()
public Object put(Object key, Object value)
public Object remove(Object key)
public Object key(int index)
public Object item(int index)
public void clear()
protected void rehash()
Copyright © 2000–2018 Apache Software Foundation. All rights reserved.