I was having a conversation about strings and various languages a while back, and the topic of string interning came up. Apparently Java and the .NET framework do this auto
String interning is useful when you need to compare strings (1) from a finite set (2) a number of times.
Then the overhead of interning a string is outweighed by the benefit of being able to do a fast == instead of equals().
Doing this can sometimes be faster than using a HashMap, which relies on hashCode() and equals() calls.