Stream.generate
Remi Forax
forax at univ-mlv.fr
Mon Jul 20 17:08:58 UTC 2015
Hi all, hi Paul,
I've found that the signature of Stream.generate doesn't to use a
wildcard hence some program are rejected even if there are valid, by
example:
public static void main(String[] args) {
Supplier<String> supplier = () -> "hello";
Stream<CharSequence> s = Stream.generate(supplier);
}
The fix is simple, in interface Stream, generate should be declared like
this :
public static<T> Stream<T> generate(Supplier<? extends T> s)
and
the field 's' of the InfiniteSupplyingSpliterator.OfRef should be also
declared as a Supplier<? extends T>.
regards,
Rémi
More information about the core-libs-dev
mailing list