public class StatementBuilder extends Object
StringBuilder buff = new StringBuilder();
for (int i = 0; i < args.length; i++) {
if (i > 0) {
buff.append(", ");
}
buff.append(args[i]);
}
to
StatementBuilder buff = new StatementBuilder();
for (String s : args) {
buff.appendExceptFirst(", ");
buff.append(a);
}
| Constructor and Description |
|---|
StatementBuilder()
Create a new builder.
|
StatementBuilder(String string)
Create a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
StatementBuilder |
append(char c)
Append a character.
|
StatementBuilder |
append(long x)
Append a number.
|
StatementBuilder |
append(String s)
Append a text.
|
void |
appendExceptFirst(String s)
Append a text, except when this method is called the first time.
|
void |
appendOnlyFirst(String s)
Append a text, but only if appendExceptFirst was never called.
|
int |
length()
Get the length.
|
StatementBuilder |
resetCount()
Reset the loop counter.
|
String |
toString() |
public StatementBuilder()
public StatementBuilder(String string)
string - the initial stringpublic StatementBuilder append(String s)
s - the text to appendpublic StatementBuilder append(char c)
c - the character to appendpublic StatementBuilder append(long x)
x - the number to appendpublic StatementBuilder resetCount()
public void appendOnlyFirst(String s)
s - the text to appendpublic void appendExceptFirst(String s)
s - the text to appendpublic int length()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.