public final class StringPool extends Object
String
instances in a way that if
equals()
is true
for two strings they will be
represented the same instance. While this is exactly what
String.intern()
does, this implementation avoids VM specific side
effects and is supposed to be faster, as neither native code is called nor
synchronization is required for concurrent lookup.Constructor and Description |
---|
StringPool() |
Modifier and Type | Method and Description |
---|---|
String |
get(String s)
Returns a normalized instance that is equal to the given
String . |
String[] |
get(String[] arr)
Returns a modified version of the array with all string slots normalized.
|
Copyright © 2024. All rights reserved.