On 11/10/2011 9:34 PM, Patrick Reinhart wrote:
Hi David,
Well in the case of a "normal" Stream you are absolutely right, but in
the Throwable case it's a PrintStream (or PrintWriter) with both do
implement the java.lang.Appendable interface (as introduced in 1.5).
This interface defines the append() method suggested in my examples.
Well what do you know! My apologies.
David
------
Cheers
Patrick "Reini" Reinhart
Zitat von "David Holmes" <david.hol...@oracle.com>:
Hi Patrick,
On 11/10/2011 3:39 PM, Patrick Reinhart wrote:
In my opinion, this could be even written in this ways:
for (StackTraceElement traceElement : trace)
s.append("\tat ").println(traceElement);
I think you are confusing your streams and your StringBuilders - s is
a stream.
David
and Similarly for:
for (int i = 0; i <= m; i++)
s.append(prefix).append("\tat ").println(trace[i]);
and the change would be only on one line ;-)
Cheers,
Patrick "Reini" Reinhart