Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

StatusBus keyed directly by status class #131

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

rcahoon
Copy link
Member

@rcahoon rcahoon commented Sep 9, 2024

Description

As long as we don't do hot reloading or crazy things with ClassLoaders, there is exactly one Class object for each class. As such, it is safe to use Class<?> as HashMap keys because it will use the default Object implementations of equals and hashCode which are based on object identity. https://stackoverflow.com/a/54076411

Small performance gain over requiring hash and equality computations on strings.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Be detailed so that your code reviewer can understand exactly how much and what kinds of testing were done, and which might still be worthwhile to do.

  • Unit tests: [Add your description here]
  • Simulator testing: [Add your description here]
  • On-robot bench testing: [Add your description here]
  • On-robot field testing: [Add your description here]

@rcahoon rcahoon requested a review from dejabot September 9, 2024 03:56
@rcahoon rcahoon merged commit b9add62 into mf3-dev Sep 9, 2024
2 checks passed
@rcahoon rcahoon deleted the rcahoon/mf3-statusbus-key branch September 9, 2024 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants