Skip to main content

Suggested cleanup for JDK 8 b106

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-09-16

1. should extend Iterable - it already requires iterator() method. Consider the following read/write pipe example:
try (final CloseableStream<String> stream = Files.lines(sourcePath, charset)){
Files.write(destPath, stream, charset);

2. Clean up java.util.Spliterator interface - for user defined streams developers would need to implement it.
a. Define Enum instead of bit flags in
int characteristics();
and use EnumSet - introduced in 1.5 specifically for this purpose.
Method default boolean hasCharacteristics(int characteristics) would be obsolete.

b. trySplit() should return Optional<Spliterator>, instead of Spliterator. Optional was introduced specifically for this purpose (i.e. to show that operation may return null value) and is used extensively in Stream interface.