-
-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Many applications using the Permutation class may not need the hashCode method, but for those that do, such as if they need to maintain a HashSet or a HashMap with Permutation as the key type, recomputing a hashCode if Permutation length is long may create overhead (especially if the Permutations in question have not changed).
Solution
Cache the hashCode the first time the hashCode method is called (similar to what the Java API does for the hashCode of String objects). The cache will need to be invalidated whenever the state of the Permutation changes (not an issue for String objects since they are immutable, so solution is not exactly like that of String).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Projects
Status
Done