Reputation: 9
Hashtable ExpiryRefData;
String icdExpiry;
try {
ExpiryRefData = CAPSUtil.getRefData(EXPIRY);
icdExpiry = (String) ExpiryRefData.get(EXPIRY);
}
can any body please explain how we are actually storing the string directly into the ExpiryRefData and how we are retrieving the values in the other string variable
Upvotes: 0
Views: 72
Reputation: 2155
As per code stated here, CAPSUtil.getRefData(EXPIRY)
returns a hashtable. Then ExpiryRefData.get(EXPIRY)
returns object which is casted to String using (String)
. For more detils refer CAPSUtil.getRefData(EXPIRY)
implementation.
As per java Hashtable reference
public class Hashtable<K,V>
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.
Upvotes: 0
Reputation: 466
Don't use a Hashtable
. Use a Map<K, String>
instead.
If you need synchronized access, consider using a synchronized wrapper (refer to java.util.Collections
).
(Edit: a Map<String, String> will do. If there is special need a
HashMap` is enough.
Upvotes: 1