I feel rejected :)
Rémi Forax
forax at univ-mlv.fr
Tue Mar 15 15:03:03 PDT 2011
On 03/15/2011 09:32 PM, Neal Gafter wrote:
> Rémi-
>
> I don't like casts either. Did you mean
> *
> public interface Folder<T> {
> public T fold(T a, T b);
> }
>
> public static <T extends Comparable<? super T>> Folder<T> max() {
> return #{ a, b -> a.compareTo(b)<0 ? b : a };
> }*
>
> Cheers,
> Neal
Yes, but I want a runtime exception here,
my test does a reduce on an array of objects.
cheers,
Rémi
>
> On Tue, Mar 15, 2011 at 8:41 AM, Rémi Forax <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
>
> And this one crash the compiler:
>
> public interface Folder<T> {
> public T fold(T a, T b);
> }
>
> public static <T> Folder<T> max() {
> return #{ a, b -> (((Comparable)a).compareTo(b)<0)? b: a };
> }
>
> It doesn't like the cast in the lambda.
>
> Rémi
>
>
>
More information about the lambda-dev
mailing list