在Java 8中,是否有一个ByteStream类?

Java 8提供Stream< T> double,int和long的专长:DoubleStream,IntStream和LongStream.但是,我在 the documentation中找不到等效的字节.

Java 8提供了一个ByteStream类?

解决方法

不,它不存在.实际上,它没有被明确地被实现,所以不能为每个原始类型的吨级集群Stream API.

从Brian Goetz在OpenJDK邮件列表中引用a mail

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.

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...