Ladies: Look at your code.—
. return Iterables.filter( . . . . employees, . . . . new Predicate<Employee>() { . . . . . . public boolean apply(Employee e) { . . . . . . . . return e.isPartTime(); . . . . . . } . . . . });
Now look at mine.
. return Iterables.filter(employees, {Employee e -> e.isPartTime()});
Now back at your code.
. return Iterables.filter( . . . . employees, . . . . new Predicate<Employee>() { . . . . . . public boolean apply(Employee e) { . . . . . . . . return e.isPartTime(); . . . . . . } . . . . });
Now back to mine.
. return Iterables.filter(employees, {Employee e -> e.isPartTime()});
Sadly, it isn't mine. But when it stops using inner-class-scented Java and switches to JDK 7, it could smell like mine.
Look down. Back up. Where are you? You're in an IDE, with the code your code could smell like. What's in your hand? Back at me. I have it. It's a lambda expression, with two arguments of that type you love.
Look again: the lambda is now a method reference!
. return Iterables.filter(employees, Employee#isPartTime);
Anything is possible when your code smells like fresh new JDK 7 hotness and not inner classes. I'm on a horse. Hurah!
Old Spice Code
Page 1 of 12 Replies - 2153 Views - Last Post: 02 September 2010 - 07:27 PM
#1
Old Spice Code
Posted 30 August 2010 - 06:05 AM

POPULAR
Taken from CarsonKahn via Forrst:
Replies To: Old Spice Code
#2
Re: Old Spice Code
Posted 30 August 2010 - 06:09 AM
I love those old spice commercials. Definitely a great marketing campaign. This also made me laugh. Good find.
Page 1 of 1

New Topic/Question
Reply


MultiQuote





|