Why doesn't CharBuffer.put(String) take a CharSequence?

Paulo Levi i30817 at gmail.com
Thu Jun 25 13:08:46 PDT 2009


Wouldn't it be nice if CharSequence had the getChars method of String?
I fear charAt makes algorithms that need buffered copies much slower.
I already asked why not, but adding methods is a incompatible change for
interfaces. In this special case, if CharSequence was a abstract class, it
could be easily be implemented by charAt, and overridden for performance in
implementations, much like InputStream is now. In fact much the same thing
could be said for sort in collections.
Missing abstract methods tend to be able to be implemented by primitive
methods.
The reason i don't like to use interfaces (except enums that can't extend
anything, and are very useful to discoverability).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20090625/af4fb0c1/attachment.html 


More information about the nio-discuss mailing list