public class StringCanon extends Object
String.intern()
but without the impact on permgen space. Uses weak references to ensure that
strings will be purged when no longer in use, and ensures that strings have a
minimal-size backing array (ie, avoids the "substring refers to huge backing
array" memory leak).Constructor and Description |
---|
StringCanon() |
Modifier and Type | Method and Description |
---|---|
String |
intern(String s)
Interns the string, returning the canonical version.
|
int |
size()
Returns the size of the canonicalized string cache.
|