The reason for having a separate key class instead of directly using {@link Class} as key is mostlyto allow for redefining hashCode
method -- for some strange reason, {@link Class} does notredefine {@link Object#hashCode} and thus uses identityhash, which is pretty slow. This makes key access using {@link Class} unnecessarily slow.
Note: since class is not strictly immutable, caller must know what it is doing, if changing field values.
|
|