Unnecessary array creation
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1573807 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
19120b7224
commit
1ca3a263e1
|
@ -478,17 +478,15 @@ public class DurationFormatUtils {
|
||||||
* @return array of Token[]
|
* @return array of Token[]
|
||||||
*/
|
*/
|
||||||
static Token[] lexx(final String format) {
|
static Token[] lexx(final String format) {
|
||||||
final char[] array = format.toCharArray();
|
final ArrayList<Token> list = new ArrayList<Token>(format.length());
|
||||||
final ArrayList<Token> list = new ArrayList<Token>(array.length);
|
|
||||||
|
|
||||||
boolean inLiteral = false;
|
boolean inLiteral = false;
|
||||||
// Although the buffer is stored in a Token, the Tokens are only
|
// Although the buffer is stored in a Token, the Tokens are only
|
||||||
// used internally, so cannot be accessed by other threads
|
// used internally, so cannot be accessed by other threads
|
||||||
StringBuilder buffer = null;
|
StringBuilder buffer = null;
|
||||||
Token previous = null;
|
Token previous = null;
|
||||||
final int sz = array.length;
|
for (int i = 0; i < format.length(); i++) {
|
||||||
for (int i = 0; i < sz; i++) {
|
final char ch = format.charAt(i);
|
||||||
final char ch = array[i];
|
|
||||||
if (inLiteral && ch != '\'') {
|
if (inLiteral && ch != '\'') {
|
||||||
buffer.append(ch); // buffer can't be null if inLiteral is true
|
buffer.append(ch); // buffer can't be null if inLiteral is true
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue