Package jenkins.util
Class TreeStringBuilder
- java.lang.Object
-
- jenkins.util.TreeStringBuilder
-
public class TreeStringBuilder extends Object
BuildsTreeString
s that share common prefixes. Callintern(String)
and you get theTreeString
that represents the same string, but as you interns more strings that share the same prefixes, thoseTreeString
s that you get back start to share data.Because the internal state of
TreeString
s get mutated as new strings are interned (to exploit new-found common prefixes),TreeString
s returned fromintern(String)
aren't thread-safe untilTreeStringBuilder
is disposed. That is, you have to make sure other threads don't see thoseTreeString
s until you are done interning strings.- Since:
- 1.473
- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description TreeStringBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dedup()
Further reduces the memory footprint by finding the same labels across multipleTreeString
s.TreeString
intern(String s)
Interns a string.TreeString
intern(TreeString s)
Interns aTreeString
created elsewhere.
-
-
-
Method Detail
-
intern
public TreeString intern(String s)
Interns a string.
-
intern
public TreeString intern(TreeString s)
Interns aTreeString
created elsewhere.
-
dedup
public void dedup()
Further reduces the memory footprint by finding the same labels across multipleTreeString
s.
-
-