I'm fairly new to java and still learning... if I have a series of strings that I need to reuse, is it better to store strings in a HashMap or should I keep them as variables?
Here's what I have:
- Screenshot: Storing strings using HashMap
- Screenshot: Storing strings as variables
I realize either would work, I'm just wondering if there is a reason to use one method over the other. Also, I have 2-3x as many strings as you see here. Any other options I should consider?
https://stackoverflow.com/questions/66467318/in-java-is-it-better-to-use-a-series-of-variables-or-a-hashmap-to-store-strings March 04, 2021 at 09:32AM
没有评论:
发表评论