DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > State of the Lambda

State of the Lambda

Baptiste Wicht user avatar by
Baptiste Wicht
·
Jul. 15, 10 · Java Zone · Interview
Like (0)
Save
Tweet
5.01K Views

Join the DZone community and get the full member experience.

Join For Free

Brian Goetz, from Oracle, has posted an updated proposal for the lambda expressions : State of the Lambda Here are some examples of closures taken from the proposal :

We can use lambda expressions to replace the heavy usage of Single Abstract Method (SAM) interfaces :

public interface CallbackHandler { 
public void callback(Context c);
}

CallbackHandler cb = { c -> System.out.println("pippo") };

We can make references to methods to use it as SAM interfaces :

class Person { 
private final String name;
private final int age;

public static int compareByAge(Person a, Person b) { ... }
public static int compareByName(Person a, Person b) { ... }
}

Person[] people = ...
Arrays.sort(people, #Person.compareByAge);

 

From http://www.baptiste-wicht.com/2010/07/state-of-the-lambda/

Interface (computing) Brian (software) Sam (text editor)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Ultra-Fast Microservices in Java: When Microstream Meets Open Liberty
  • Package and Deploy a Lambda Function as a Docker Container With AWS CDK
  • Agile Coaches Without Technical Knowledge: How to Overcome the Paradox
  • Usage of Java Streams and Lambdas in Selenium WebDriver

Comments

Java Partner Resources

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo