java.util.Hashtable
This class implements a hash table, which maps keys to values. Any non-null object can be used as a key or as a value.
Some methods of Hashtable class
clear(): This method Clears this hashtable so that it contains no keys.
clone(): This method creates a shallow copy of this hashtable.
compute(K, BiFunction): This method attempts to compute a mapping for the specified key and its current mapped value.
computeIfAbsent(K, Function): If the specified key is not already associated with a value attempt to compute its value using the given mapping function and enter it into this map unless null.
computeIfPresent(K, BiFunction): 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.
containsKey(Object): This method tests if the specified object is a key in this hashtable.
containsValue(Object): This method returns true if this hashtable maps one or more keys to this value.
entrySet(): This method returns a Set view of the mappings contained in this map.
equals(Object): This method compares the specified Object with this Map for equality, as per the definition in the Map interface.
forEach(BiConsumer): This method performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
get(Object): This method returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
getOrDefault(Object, V): This method returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
hashCode(): This method returns the hash code value for this Map as per the definition in the Map interface.
isEmpty(): This method tests if this hashtable maps no keys to values.
keySet(): This method returns a Set view of the keys contained in this map.
merge(K, V, BiFunction): If the specified key is not already associated with a value or is associated with null, associate it with the given non-null value. Otherwise, replaces the associated value with the results of the given remapping function, or removes it if the result is null.
put(K, V): This method maps the specified key to the specified value in this hashtable.
putAll(Map): This method copies all of the mappings from the specified map to this hashtable.
putIfAbsent(K, V): If the specified key is not already associated with a value associates it with the given value and returns null, else returns the current value.
remove(Object): This method removes the key (and its corresponding value) from this hashtable.
remove(Object, Object): This method removes the entry for the specified key only if it is currently mapped to the specified value.
replace(K, V): This method replaces the entry for the specified key only if it is currently mapped to some value.
replace(K, V, V): This method replaces the entry for the specified key only if currently mapped to the specified value.
replaceAll(BiFunction): This method 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.
size(): This method returns the number of keys in this hashtable.
values(): This method returns a Collection view of the values contained in this map.
No comments:
Post a Comment