Re:"..best direction for evolving Java is to encourage a mor...
by natesm on Friday August 19, 2011 @11:47AM
(#2903754)
I don't really know Java, so this is made up Java/C#/something, but compare these:
Or:
Which do you think is more elegant and readable? For a slightly more extreme example, what if we want the numbers less than 100:
Or this:
[ Parent
| on HN ]
Re:"..best direction for evolving Java is to encourage a mor...
by jshen on Friday August 19, 2011 @01:13PM
(#2904061)
I wrote a blog post with a nearly identical example.
http://jaydonnell.com/blog/2011/08/07/is-your-idea-clealry-e...
The code gets nutty when you have to do multiple transforms on collections. There are some libraries in Java which make it more bearable.
http://code.google.com/p/lambdaj/
List<Person> sortedByAgePersons = sort(persons, on(Person.class).getAge());