public class TreeStringBuilder extends Object
TreeStrings that share common prefixes. Call intern(String) and you get the TreeString that represents the same string, but as you interns more strings that share the same prefixes, those
TreeStrings that you get back start to share data.
Because the internal state of TreeStrings get mutated as new strings are interned (to exploit new-found
common prefixes), TreeStrings returned from intern(String) aren't thread-safe until TreeStringBuilder is disposed. That is, you have to make sure other threads don't see those TreeStrings
until you are done interning strings.
| Constructor and Description |
|---|
TreeStringBuilder() |
| Modifier and Type | Method and Description |
|---|---|
void |
dedup()
Further reduces the memory footprint by finding the same labels across multiple
TreeStrings. |
TreeString |
intern(String string)
Interns a string.
|
TreeString |
intern(TreeString treeString)
Interns a
TreeString created elsewhere. |
public TreeString intern(String string)
string - the string to internTreeString instancepublic TreeString intern(TreeString treeString)
TreeString created elsewhere.treeString - the TreeString to internTreeString instancepublic void dedup()
TreeStrings.Copyright © 2018. All rights reserved.