Optional.or() doesn't use a wildcard in its signature
spliterator at gmail.com
Sun Nov 1 17:01:39 UTC 2015
2015-11-01 1:12 GMT+01:00 Michael Nascimento <misterm at gmail.com>:
> Hi Vitaly,
> Exactly, I was just trying to point out the method signature seems broken
Rethinking it, I believe you are right.
public <R extends T> Optional<T> or(Supplier<Optional<R>> supplier)
would be more general and still be sound type-wise.
There's a similar issue for Stream generate / iterate in the bugtracker
> On 31 Oct 2015 11:59, "Vitaly Davidovich" <vitalyd at gmail.com> wrote:
>> This would require Supplier<Optional<? extends T>>, not Supplier<? extends
>> sent from my phone
>> On Oct 31, 2015 2:49 PM, "Michael Nascimento" <misterm at gmail.com> wrote:
>>> If this instance is an Optional<CharSequence> , passing an
>>> Optional<StringBuilder> will fail to compile.
More information about the core-libs-dev