News for hackers. Stuff that matters.
Re:It Can Happen to You by mnw21cam on Thursday March 04, 2021 @06:37AM (#26341176)
Yes, Strings are immutable, so they only calculate their hashCode once, then cache it. However, you need to explicitly intern them with String.intern() if you want to avoid multiple copies of the same String.

There are no comments on this comment yet.