Package gov.nih.mipav.model.structures
Class CustomHashtable<V>
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,V>
CustomHashtable extends the Hashtable class and adds some methods for generating keys for new elements to the
Hashtable. This is designed for storing the active images, but can also be used for image frames or any other list
that needs to enforce unique keys.
- Version:
- 0.1 November 16, 2001
- Author:
- Lynne M. Pusanik
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longUse serialVersionUID for interoperability. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty hashtable with a default capacity and load factor, which is 0.75.CustomHashtable(int capacity) Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75.CustomHashtable(int capacity, float loadFactor) Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.CustomHashtable(Map<String, V> t) Constructs a new hashtable with the same mappings as the given Map. -
Method Summary
Methods inherited from class java.util.Hashtable
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
-
Constructor Details
-
CustomHashtable
public CustomHashtable()Constructs a new, empty hashtable with a default capacity and load factor, which is 0.75. -
CustomHashtable
Constructs a new hashtable with the same mappings as the given Map. The hashtable is created with a capacity of twice the number of entries in the given Map or 11 (whichever is greater), and a default load factor, which is 0.75.- Parameters:
t- Map to base the hashtable on
-
CustomHashtable
public CustomHashtable(int capacity) Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75.- Parameters:
capacity- initial capacity of the hashtable
-
CustomHashtable
public CustomHashtable(int capacity, float loadFactor) Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.- Parameters:
capacity- initial capacity of the hashtableloadFactor- the load factor of the hashtable
-
-
Method Details
-
makeUniqueKey
Returns a unique key string for the hashtable based on a given key string.- Parameters:
key- A string that we want to base a hashtable key on.- Returns:
- A unique key, which should be used as an input to the
method.
invalid reference
put()
-
appendKey
Starts with a key that already exists in the hashtable and appends integers to its toString(). Throws a NullPointer Exception if a unique key can't be found after appending all the integer values.- Parameters:
key- DOCUMENT ME!- Returns:
- returns the newly formed key.
- Throws:
NullPointerException- thrown when key cannot be appended to make a unique key.
-