Questions about Stream/Iterable/Files - and possibly the compiler
Paul Sandoz
paul.sandoz at oracle.com
Fri Nov 6 08:36:03 UTC 2015
> On 5 Nov 2015, at 23:05, Remi Forax <forax at univ-mlv.fr> wrote:
>>
>> At last, question B: Given all those premises, is there a specific reason
>> for which Files.write() hasn't been overloaded with a version capable of
>> accepting a Stream<String>?
No particular reason, just never got around to thinking about it. Seems like reasonable thing to do.
I logged an issue:
https://bugs.openjdk.java.net/browse/JDK-8141608 <https://bugs.openjdk.java.net/browse/JDK-8141608>
>> It would have been the perfect complement of
>> Files.lines()
>
> adding overloads with different interfaces is not a good idea, you can have a class that implements both interfaces (Stream and Iterable).
>
Ordinarily i would agree with you, but in this case a class that implements Stream and Iterable is arguably a very confused class indeed (much like a class that implements Iterable and Iterator).
Paul.
More information about the core-libs-dev
mailing list