public class CharsDeduplicator
extends java.lang.Object
Class used for de duplicating strings into a more minimal storage form. This does a more
aggressive form of reference aggregation than String.intern(). And in fact the cache
continues to grow infinitely until clearCache() is invoked.
The returned references are not Strings, but rather a reference which only holds the
char[], all invocations then calculate the result at the time of invocation. Trading
memory for extra CPU cycles.
| Constructor and Description |
|---|
CharsDeduplicator() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearCache()
Clears the stored cache, freeing up all stored memory here.
|
static LightCharSequence |
deDuplicate(java.lang.String str)
De-duplicate the provided string into a lighter memory form.
|
public static LightCharSequence deDuplicate(java.lang.String str)
str - String to search forpublic static void clearCache()