-2

Why Java 8 does not have StringStream and CharStream.

StringStream.of("String1","String2");

StringStream.concat(stream1,stream2);

StringStream.builder().add("String1").add("string2").accept("string3");
Anil
  • 364
  • 3
  • 15

1 Answers1

8

There is no char stream for same reason there is no byte stream. All those specific stream added for optimization (no boxing/unboxing). char and byte internally represented as int so there will be no profit in adding them.

Of course they should add them for convenience, but they didn't.

There is no String stream because there is no reason for it. String is reference type, so normal stream will work with it just fine.

talex
  • 17,973
  • 3
  • 29
  • 66
  • *Of course they should add them for convenience, but they didn't.* .. what convenience, could you elaborate? – Naman Jan 07 '19 at 04:16
  • 1
    @nullpointer when `IntStream` used for `byte` you have to convert values in most operations. – talex Jan 07 '19 at 04:18