CharStream and ByteStream?
brian.goetz at oracle.com
Fri Mar 8 08:38:15 PST 2013
Short answer: no.
It is not worth another 100K+ of JDK footprint each for these forms
which are used almost never. And if we added those, someone would
demand short, float, or boolean.
Put another way, if people insisted we had all the primitive
specializations, we would have no primitive specializations. Which
would be worse than the status quo.
On 3/8/2013 11:24 AM, Zhong Yu wrote:
> Many applications process streams of chars/bytes. Using IntStream to
> represent char/byte stream is a little inconvenient. Should we add
> CharStream and ByteStream as well?
> Particularly, conversion between int and byte is quite confusing,
> there are two ways to encode a byte in the 0x80-0xFF range in an int.
> Producers have to always specify which encoding they use, for example
> see InputStream.read(). Consumers can handle both encodings but it
> requires attention. The problem is more subtle in lambda expressions,
> since parameter types aren't declared, programmers can easily forget
> that they are dealing with ints instead of bytes.
> Zhong Yu
More information about the lambda-dev