public abstract class StringInternCache extends StringCache
String.intern().
The method intern() creates an exact copy of a String object in the heap memory
and stores it in the String constant pool.
Note that, if another String with the same contents exists in the String constant pool,
then a new object won't be created and the new reference will point to the other String.
Time complexity of intern() is O(n) where n is the current size of the string pool.| Constructor and Description |
|---|
StringInternCache(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
cacheString(java.lang.String s)
Caches the passed String if not yet cached and returns the cached instance.
|
getNamepublic java.lang.String cacheString(java.lang.String s)
StringCacheICopyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.