public final class StringPool
extends java.lang.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 | Description |
---|---|
StringPool() |
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
get(java.lang.String s) |
Returns a normalized instance that is equal to the given
String . |
java.lang.String[] |
get(java.lang.String[] arr) |
Returns a modified version of the array with all string slots normalized.
|
public java.lang.String get(java.lang.String s)
String
.s
- any string or null
null
public java.lang.String[] get(java.lang.String[] arr)
arr
- String array or null
null
Copyright © 2018. All rights reserved.