Almost, Moandji. This would be the syntax you're looking for in this
particular example:
List<String> userNames = userList.map(#(User u) (u.getName()));
Or, alternatively (both are legit):
List<String> userNames = userList.map(#(User u) {
return u.getName();
});
If I put them in a bad light, I apologize - that wasn't my intent. My
intent was to simply state the proposal, and inject a little despair
into the crazy syntax for function -types-. The syntax for the
closures themselves is fine, and, in fact, one of the few that really
works well with existing java style guides (braces imply newlines,
etc).
On Jun 1, 10:35 am, Moandji Ezana <[email protected]> wrote:
> On Tue, Jun 1, 2010 at 7:12 AM, Michael Neale <[email protected]>wrote:
>
> > I think it shows it in its worst light, when others show examples it
> > is OK I guess...
>
> I agree, I don't think they're particularly ugly. Taking a simple, but real,
> example:
>
> List<String> userNames = userList.map(#(User u) {
> u.getName();
>
> });
>
> I can't see anything so terrible or unreadable about that.
>
> Moandji
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.