|
|||||||||
| Home >> All >> [ Acme overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
Acme
Class IntHashtable

java.lang.Objectjava.util.Dictionary
Acme.IntHashtable
- All Implemented Interfaces:
- java.lang.Cloneable
- public class IntHashtable
- extends java.util.Dictionary
- implements java.lang.Cloneable
- extends java.util.Dictionary
A Hashtable that uses ints as the keys.
Use just like java.util.Hashtable, except that the keys must be ints. This is much faster than creating a new Integer for each access.
Fetch the software.
Fetch the entire Acme package.
| Field Summary | |
private int |
count
|
private float |
loadFactor
|
private IntHashtableEntry[] |
table
|
private int |
threshold
|
| Constructor Summary | |
IntHashtable()
|
|
IntHashtable(int initialCapacity)
|
|
IntHashtable(int initialCapacity,
float loadFactor)
|
|
| Method Summary | |
void |
clear()
|
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
boolean |
contains(java.lang.Object value)
|
boolean |
containsKey(int key)
|
java.util.Enumeration |
elements()
Returns an Enumeration of the values in this Dictionary. |
java.lang.Object |
get(int key)
|
java.lang.Object |
get(java.lang.Object okey)
Returns the value associated with the supplied key, or null if no such value exists. |
boolean |
isEmpty()
Returns true when there are no elements in this Dictionary. |
java.util.Enumeration |
keys()
Returns an Enumeration of the keys in this Dictionary |
java.lang.Object |
put(int key,
java.lang.Object value)
|
java.lang.Object |
put(java.lang.Object okey,
java.lang.Object value)
Inserts a new value into this Dictionary, located by the supplied key. |
protected void |
rehash()
|
java.lang.Object |
remove(int key)
|
java.lang.Object |
remove(java.lang.Object okey)
Removes from the Dictionary the value located by the given key. |
int |
size()
Returns the number of values currently in this Dictionary. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
table
private IntHashtableEntry[] table
loadFactor
private float loadFactor
count
private int count
threshold
private int threshold
| Constructor Detail |
IntHashtable
public IntHashtable(int initialCapacity,
float loadFactor)
IntHashtable
public IntHashtable(int initialCapacity)
IntHashtable
public IntHashtable()
| Method Detail |
isEmpty
public boolean isEmpty()
- Description copied from class:
java.util.Dictionary - Returns true when there are no elements in this Dictionary.
clear
public void clear()
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
contains
public boolean contains(java.lang.Object value)
containsKey
public boolean containsKey(int key)
elements
public java.util.Enumeration elements()
- Description copied from class:
java.util.Dictionary - Returns an Enumeration of the values in this Dictionary.
get
public java.lang.Object get(int key)
get
public java.lang.Object get(java.lang.Object okey)
- Description copied from class:
java.util.Dictionary - Returns the value associated with the supplied key, or null
if no such value exists. Since Dictionaries are not allowed null keys
or elements, a null result always means the key is not present.
keys
public java.util.Enumeration keys()
- Description copied from class:
java.util.Dictionary - Returns an Enumeration of the keys in this Dictionary
put
public java.lang.Object put(int key, java.lang.Object value)
put
public java.lang.Object put(java.lang.Object okey, java.lang.Object value)
- Description copied from class:
java.util.Dictionary - Inserts a new value into this Dictionary, located by the
supplied key. Dictionary does not support null keys or values, so
a null return can safely be interpreted as adding a new key.
remove
public java.lang.Object remove(int key)
remove
public java.lang.Object remove(java.lang.Object okey)
- Description copied from class:
java.util.Dictionary - Removes from the Dictionary the value located by the given key. A null
return safely means that the key was not mapped in the Dictionary.
size
public int size()
- Description copied from class:
java.util.Dictionary - Returns the number of values currently in this Dictionary.
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
rehash
protected void rehash()
|
|||||||||
| Home >> All >> [ Acme overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC