Migrating methods in Collections

Brian Goetz brian.goetz at oracle.com
Thu Dec 24 19:34:45 UTC 2015


>>
>>>      long findFirst(E e);
>>>      long findLast(E e);
>>
>> Arguably better as findXxx(Predicate)
>
> I agree about adding predicate versions.
> But people will complain about requiring a lambda in plain version
> that otherwise ought to be simple enough to compile into
> optimal machine instruction loop for ArrayLists
>

The usual (bad) argument against overloading findXxx(E) and 
findXxx(Predicate<E>) is that null is accepted by both signatures.  But 
I have no problem with both, and both have reasonable defaults so can be 
freely added.


More information about the valhalla-spec-experts mailing list