Posts

Showing posts from October, 2014

Lambda Expressions

Lambda Expressions : Lambda expressions are a new and important feature included in Java SE 8. They provide a clear and concise way to represent one method interface using an expression. Lambda expressions also improve the Collection libraries making it easier to iterate through, filter, and extract data from a Collection In addition, new concurrency features improve performance in multicore environments. Why Lambdas? A lambda expression is a block of code that you can pass around so it can be executed later, just once or multiple times. Syntax of Lambda Expressions A lambda expression consists of the following: A comma-separated list of formal parameters enclosed in parentheses The arrow token,  -> A body, which consists of a single expression or a statement block. Syantax Structure : (arg1, arg2...) -> { body } (type1 arg1, type2 arg2...) -> { body } Example : ( int a ,...