Inline the Pair toString for performance, and specify the format

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1099413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2011-05-04 11:13:17 +00:00
parent bfb76fae2f
commit f1db2dda80
1 changed files with 2 additions and 3 deletions

View File

@ -157,14 +157,13 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
} }
/** /**
* <p>Returns a String representation of this Pair as completed by * <p>Returns a String representation of this pair using the format {@code ($left,$right)}.</p>
* {@link #formatTo(Formatter, int, int, int)}.</p>
* *
* @return a string describing this object, not null * @return a string describing this object, not null
*/ */
@Override @Override
public String toString() { public String toString() {
return FormattableUtils.toString(this); return new StringBuilder().append('(').append(getLeft()).append(',').append(getRight()).append(')').toString();
} }
/** /**