another useful default method - Appendable#appendCodePoint

Per Bothner per at bothner.com
Wed Dec 26 14:56:43 PST 2012


Not directly in Lambda's purview, but this seems like it would be
a useful addition to Appendable - and another nice example of how
default methods are helpful:

package java.io;
interface Appendable {
     ...
     public Appendable appendCodePoint(int c) throws IOException default {
         if (c >= 0x10000) {
             append((char) (((c - 0x10000) >> 10) + 0xD800));
             c = (c & 0x3FF) + 0xDC00;
         }
         append((char) c);
         return this;
     }
}
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/


More information about the lambda-dev mailing list