public final class StringBuilderPool
extends java.lang.Object
StringBuilder
objects,
by either re-using or creating a new instance on getInstance()
,
and emptying and keeping a previously used instance on StringBuilderPool#finalToString()
,
assuming that the StringBuilderPool can fit more StringBuilder instances.Constructor and Description |
---|
StringBuilderPool() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
finalToString(java.lang.StringBuilder b)
Builds a string, resets (empties) the StringBuilder used and returns it to the pool.
|
static java.lang.StringBuilder |
getInstance()
Call this method to create-or-reuse a string builder instance.
|
static java.lang.StringBuilder |
getInstance(java.lang.String s)
Call this method to create-or-reuse an empty string builder instance,
and immediately append the given string for convenience.
|
static void |
release(java.lang.StringBuilder b) |
public static final java.lang.StringBuilder getInstance()
finalToString(StringBuilder)
to free the resource again after you are done using it.StringBuilderPool#getInstance(String)}
public static final java.lang.StringBuilder getInstance(java.lang.String s)
finalToString(StringBuilder)
to free the resource again after you are done using it.StringBuilderPool#getInstance()}
public static final void release(java.lang.StringBuilder b)
public static final java.lang.String finalToString(java.lang.StringBuilder b)
b
- the StringBuilder to finalize.Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.