Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>
Direct Known Subclasses:
Properties, UIDefaults

  • Constructor Summary

    Constructors

    Hashtable()

    Constructs a new, empty hashtable with a default initial capacity (11) and load factor (0.75).

    Hashtable(int initialCapacity)

    Constructs a new, empty hashtable with the specified initial capacity and default load factor (0.75).

    Hashtable(int initialCapacity, float loadFactor)

    Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

    Hashtable(Map<? extends K, ? extends V> t)

    Constructs a new hashtable with the same mappings as the given Map.

  • Method Summary

    void

    clear()

    Clears this hashtable so that it contains no keys.

    clone()

    Creates a shallow copy of this hashtable.

    compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)

    Attempts to compute a mapping for the specified key and its current mapped value, or null if there is no current mapping (optional operation).

    computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction)

    If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null (optional operation).

    computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)

    If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value (optional operation).

    boolean

    Tests if some key maps into the specified value in this hashtable.

    boolean

    Tests if the specified object is a key in this hashtable.

    boolean

    Returns true if this hashtable maps one or more keys to this value.

    elements()

    Returns an enumeration of the values in this hashtable.

    entrySet()

    Returns a Set view of the mappings contained in this map.

    boolean

    Compares the specified Object with this Map for equality, as per the definition in the Map interface.

    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

    int

    hashCode()

    Returns the hash code value for this Map as per the definition in the Map interface.

    boolean

    isEmpty()

    Tests if this hashtable maps no keys to values.

    keys()

    Returns an enumeration of the keys in this hashtable.

    keySet()

    Returns a Set view of the keys contained in this map.

    merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction)

    If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value (optional operation).

    put(K key, V value)

    Maps the specified key to the specified value in this hashtable.

    void

    putAll(Map<? extends K, ? extends V> t)

    Copies all of the mappings from the specified map to this hashtable.

    protected void

    rehash()

    Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.

    Removes the key (and its corresponding value) from this hashtable.

    int

    size()

    Returns the number of keys in this hashtable.

    toString()

    Returns a string representation of this Hashtable object in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space).

    values()

    Returns a Collection view of the values contained in this map.

    Methods declared in class Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    Methods declared in interface Map

    forEach, getOrDefault, putIfAbsent, remove, replace, replace, replaceAll

    default void

    Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.

    default V

    Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.

    default V

    If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value (optional operation).

    default boolean

    Removes the entry for the specified key only if it is currently mapped to the specified value (optional operation).

    default V

    Replaces the entry for the specified key only if it is currently mapped to some value (optional operation).

    default boolean

    replace(K key, V oldValue, V newValue)

    Replaces the entry for the specified key only if currently mapped to the specified value (optional operation).

    default void

    Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation).

  • Constructor Details

    • Hashtable

    • Hashtable

    • Hashtable

    • Hashtable

  • Method Details

    • size

    • isEmpty

    • keys

    • elements

    • contains

    • containsValue

    • containsKey

    • get

    • rehash

    • put

    • remove

    • putAll

    • clear

    • clone

    • toString

    • keySet

    • entrySet

    • values

    • equals

    • hashCode

    • computeIfAbsent

    • computeIfPresent

    • compute

    • merge