--- old/src/java.base/share/classes/java/lang/Appendable.java 2016-12-09 08:31:41.810372432 +0100 +++ new/src/java.base/share/classes/java/lang/Appendable.java 2016-12-09 08:31:41.671373476 +0100 @@ -118,4 +118,29 @@ * If an I/O error occurs */ Appendable append(char c) throws IOException; + + /** + * Appends {@code n} copies of the specified character to this + * {@code Appendable}. + * + * @param c + * The character to append + * @param n + * The number of copies + * + * @return A reference to this {@code Appendable} + * + * @throws IOException + * If an I/O error occurs + * @throws IllegalArgumentException + * If {@code n} is negative + */ + default Appendable appendN(char c, int n) throws IOException { + if (n < 0) { + throw new IllegalArgumentException("Negative number of" + + " copies: " + n); + } + StringBuilder sb = new StringBuilder(n); + return append(sb.appendN(c, n)); + } }