another useful default method - Appendable#appendCodePoint

Per Bothner per at bothner.com
Thu Dec 27 10:26:50 PST 2012


On 12/27/2012 02:58 AM, Gernot Neppert wrote:
> Luckily, all that low-level stuff has been dealt with in class
> java.lang.Character, so your default implementation could be re-written as:
>
> public Appendable appendCodePoint(int c) throws IOException default {
>     return append(new String(Character.toChars(c));
> }

It could be - if you don't care about performance.  Allocating
a char[] *and* a String for each character doesn't seem winning ...
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/


More information about the lambda-dev mailing list