...
Code Block | ||
---|---|---|
| ||
public class LicenseManager { Map<LicenseType, String> licenseMap = new IdentityHashMap<LicenseType, String>(); // ... } |
According to the Java API API [API 062006]
quote
This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values). In other words, in an IdentityHashMap, two keys k1 and k2 are considered equal if and only if (k1==k2). (In normal Map implementations (like HashMap) two keys k1 and k2 are considered equal if and only if (k1==null ? k2==null : k1.equals(k2)).)
...
Consequently, the overridden methods cannot expose internal class details. The client program can continue to add license keys and even retrieve the added key-value pairs as demonstrated by the following client code.
...