lambda binary snapshots

Brian Goetz brian.goetz at oracle.com
Sun Nov 13 07:40:35 PST 2011


They both should compile with the prototype, but note that the prototype compiler still uses the # symbol as the infix operator for method references.  

On Nov 13, 2011, at 4:08 PM, Colin Decker wrote:

> Is it going to be possible for either of the following statements to compile at some point?
> 
> Comparator<String> c = Comparators.comparing(s -> s.length());
> Comparator<String> c = Comparators.comparing(String::length); // String#length now
> 
> -- 
> Colin
> 
> 
> On Sun, Nov 13, 2011 at 3:33 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
> in general, keep in mind that the library work is all completely speculative and may look nothing like the final product.
> 
> Composing comparators allows you to impose a dictionary ordering.  So:
> 
>  Comparator<Person> byLastName = comparing(Person::getLastName);
> 
>  Comparator<Person> byLastAndFirstName = byLastName.compose(comparing(Person::getFirstName));
> 
> The second of these will compare by last and first name, that is, when last name is equal, it will resolve ties by comparing first name.
> 
> Because this is an extension method, the receiver in the invocation becomes the first argument to the default:
> 
>  foo.compose(bar)
> 
> becomes
> 
>  compose(foo, bar)
> 
> when it is actually executed.
> 
> 
> 
> On Nov 13, 2011, at 1:52 AM, Arul Dhesiaseelan wrote:
> 
> > JDK 8 Lambda build is cool. Thanks for making this available!
> >
> > I was playing with defender methods, wondering what makes this scenario
> > work:
> >
> > In Comparator, there is a new default method compose() which has single
> > parameter:
> >
> > Comparator<T> compose(Comparator<? super T> other) default
> > Comparators.compose;
> >
> > The default implementation in Comparators has two parameters:
> >
> > public static<T> Comparator<T> compose(Comparator<T> first, Comparator<?
> > super T> second) {}
> >
> > For example, the woven class String.CASE_INSENSITIVE_ORDER
> > (CaseInsensitiveComparator.class) has single parameter. I am not sure I
> > understand how this works, need help.
> >
> > -Arul
> >
> 
> 
> 



More information about the lambda-dev mailing list