SlideShare a Scribd company logo
Lambda-Tutorial 
Hands-on-Lab 
Dmitry Alexandrov 
Martin Toshev 
Ivan St. Ivanov 
Mani Sarkar
Contents: 
• Environment setup 
• Rules 
• Tasks: 
• Internal vs External Iteration 
• Filtering and Collecting 
• Mapping 
• Method References
Environment setup: 
• Java 8 
https://jdk8.java.net/lambda/ 
… build yours from OpenJDK repo 
• IntelliJ IDEA CE 
http://www.jetbrains.com/idea/free_java_ide.html 
Eclipse in current state is NOT recommended! 
• Vi or emacs for geeks
Environment setup: 
• Take the code 
• Import as a Maven project 
• Set Java8 profile (source compatibility) 
• Run ConfigureYourLambdaBuildOfJdk and see if it 
compiles!
Rules: 
• We have several classes and test for them. 
• Fix compilation errors in both classes and tests 
• Find “// your code here” and write the code! 
• Run the tests. Try to make them green! 
• … read the comments.. They are useful!
The tasks
Internal vs External Iteration : 
• External 
for (Shape shape: myShapes) { 
shape.setColor(RED); 
} 
• Internal 
myShapes.forEach(shape -> shape.setColor(RED));
Filtering and Collecting : 
• Java7 
for (String s: otherThings) { 
if (satisfiesSomeCondition(s)) { 
things.add(s); 
} 
} 
• Java8 
otherThings.stream() 
.filter(s -> satisfiesSomeCondition(s)) 
.collect(Collectors.toList());
Mapping : 
• Java7 
List<String> upperCaseStrings = new ArrayList<>(); 
for (String s: mixedCaseStrings) { 
upperCaseStrings.add(s.toUpperCase()); 
} 
• Java8 
mixedCaseStrings.stream() 
.map(s -> s.toUpperCase()) 
.collect(Collectors.toList());
Mapping : 
Lambda expression: 
myStrings.map(s -> s.toUpperCase()); 
Using method reference: 
myStrings.map(String::toUpperCase); 
Can be used with: 
• Static method belonging to a particular class 
• Instance method bound to a particular object instance 
• Instance method bound to a particular class 
• Constructor belonging to a particular class
Default Method: 
• Java8 
public interface A { 
default void foo(){ 
System.out.println("Calling A.foo()"); 
} 
} 
public class Clazz implements A { 
} 
Clazz clazz = new Clazz(); 
clazz.foo(); // Calling A.foo()
Default Method: 
• Java8 
public class Clazz2 implements A { 
@Override 
public void foo(){ 
System.out.println("Calling A.foo()"); 
} 
} 
Clazz2 clazz2 = new Clazz2(); 
clazz2.foo(); // Calling A.foo()
Now have fun!!!

More Related Content

What's hot (17)

Lecture 9
Lecture 9Lecture 9
Lecture 9
talha ijaz
 
Java for newcomers
Java for newcomersJava for newcomers
Java for newcomers
Amith jayasekara
 
Java collection
Java collectionJava collection
Java collection
Deepak Kumar
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
ankitgarg_er
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
Edureka!
 
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
WebStackAcademy
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
Berk Soysal
 
Java Collections
Java CollectionsJava Collections
Java Collections
parag
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Knolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in ScalaKnolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
 
Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)
Tomer Gabel
 
งานย่อย 6
งานย่อย 6งานย่อย 6
งานย่อย 6
Mittapan Chantanyakan
 
Java tutorial part 4
Java tutorial part 4Java tutorial part 4
Java tutorial part 4
Mumbai Academisc
 
Knolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in ScalaKnolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in Scala
Ayush Mishra
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
Minal Maniar
 
Collection
CollectionCollection
Collection
Guna Sekaran
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
ankitgarg_er
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
Edureka!
 
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
WebStackAcademy
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
Berk Soysal
 
Java Collections
Java CollectionsJava Collections
Java Collections
parag
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Knolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in ScalaKnolx Session: Introducing Extractors in Scala
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
 
Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)
Tomer Gabel
 
Knolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in ScalaKnolx Session : Built-In Control Structures in Scala
Knolx Session : Built-In Control Structures in Scala
Ayush Mishra
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
Minal Maniar
 

Viewers also liked (16)

Hhp paper
Hhp paperHhp paper
Hhp paper
mikaylanelson13
 
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Mani Sarkar
 
Java2 days 2013-j-treg
Java2 days 2013-j-tregJava2 days 2013-j-treg
Java2 days 2013-j-treg
Mani Sarkar
 
Ljc conf open jdk betterrev bof
Ljc conf open jdk betterrev bofLjc conf open jdk betterrev bof
Ljc conf open jdk betterrev bof
Mani Sarkar
 
How is Java / JVM built ? Adopt OpenJDK is your answer !
How is Java / JVM built ? Adopt OpenJDK is your answer !How is Java / JVM built ? Adopt OpenJDK is your answer !
How is Java / JVM built ? Adopt OpenJDK is your answer !
Mani Sarkar
 
Adopt OpenJDK presentation (slide deck)
Adopt OpenJDK presentation (slide deck)Adopt OpenJDK presentation (slide deck)
Adopt OpenJDK presentation (slide deck)
Mani Sarkar
 
Scaun cu rotile cu verticalizare
Scaun cu rotile cu verticalizareScaun cu rotile cu verticalizare
Scaun cu rotile cu verticalizare
Toda International
 
Adopt OpenJDK, Betterrev blind ignite presentation
Adopt OpenJDK, Betterrev blind ignite presentationAdopt OpenJDK, Betterrev blind ignite presentation
Adopt OpenJDK, Betterrev blind ignite presentation
Mani Sarkar
 
Essential technical skills
Essential technical skillsEssential technical skills
Essential technical skills
Mani Sarkar
 
Refactoring developer habits
Refactoring developer habitsRefactoring developer habits
Refactoring developer habits
Mani Sarkar
 
How is Java / JVM built ? Back then and now...
How is Java / JVM built ? Back then and now...How is Java / JVM built ? Back then and now...
How is Java / JVM built ? Back then and now...
Mani Sarkar
 
Kanban kata
Kanban kataKanban kata
Kanban kata
Mani Sarkar
 
Leaning on the two Ts
Leaning on the two TsLeaning on the two Ts
Leaning on the two Ts
Mani Sarkar
 
History of java
History of javaHistory of java
History of java
Mani Sarkar
 
Sonar qube to impove code quality
Sonar qube   to impove code qualitySonar qube   to impove code quality
Sonar qube to impove code quality
Mani Sarkar
 
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Fosdem2014 fromwebrevtobetterrevbryantsarkar-140203131215-phpapp02
Mani Sarkar
 
Java2 days 2013-j-treg
Java2 days 2013-j-tregJava2 days 2013-j-treg
Java2 days 2013-j-treg
Mani Sarkar
 
Ljc conf open jdk betterrev bof
Ljc conf open jdk betterrev bofLjc conf open jdk betterrev bof
Ljc conf open jdk betterrev bof
Mani Sarkar
 
How is Java / JVM built ? Adopt OpenJDK is your answer !
How is Java / JVM built ? Adopt OpenJDK is your answer !How is Java / JVM built ? Adopt OpenJDK is your answer !
How is Java / JVM built ? Adopt OpenJDK is your answer !
Mani Sarkar
 
Adopt OpenJDK presentation (slide deck)
Adopt OpenJDK presentation (slide deck)Adopt OpenJDK presentation (slide deck)
Adopt OpenJDK presentation (slide deck)
Mani Sarkar
 
Scaun cu rotile cu verticalizare
Scaun cu rotile cu verticalizareScaun cu rotile cu verticalizare
Scaun cu rotile cu verticalizare
Toda International
 
Adopt OpenJDK, Betterrev blind ignite presentation
Adopt OpenJDK, Betterrev blind ignite presentationAdopt OpenJDK, Betterrev blind ignite presentation
Adopt OpenJDK, Betterrev blind ignite presentation
Mani Sarkar
 
Essential technical skills
Essential technical skillsEssential technical skills
Essential technical skills
Mani Sarkar
 
Refactoring developer habits
Refactoring developer habitsRefactoring developer habits
Refactoring developer habits
Mani Sarkar
 
How is Java / JVM built ? Back then and now...
How is Java / JVM built ? Back then and now...How is Java / JVM built ? Back then and now...
How is Java / JVM built ? Back then and now...
Mani Sarkar
 
Leaning on the two Ts
Leaning on the two TsLeaning on the two Ts
Leaning on the two Ts
Mani Sarkar
 
Sonar qube to impove code quality
Sonar qube   to impove code qualitySonar qube   to impove code quality
Sonar qube to impove code quality
Mani Sarkar
 

Similar to Java2 days 2013-lambda (20)

Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
Ryan Cuprak
 
10 jdbc
10 jdbc10 jdbc
10 jdbc
snopteck
 
10 jdbc
10 jdbc10 jdbc
10 jdbc
snopteck
 
Lambdas in Java 8
Lambdas in Java 8Lambdas in Java 8
Lambdas in Java 8
Tobias Coetzee
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
Martin Toshev
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentation
nrjoshiee
 
Java Collection
Java CollectionJava Collection
Java Collection
DeeptiJava
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
Naveen Hegde
 
Jdbc
JdbcJdbc
Jdbc
lathasiva
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
Kyle Smith
 
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
PptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfyPptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
dnthulk
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part I
SivaSankari36
 
Json generation
Json generationJson generation
Json generation
Aravindharamanan S
 
New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
Ahmed mar3y
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
Fahad Golra
 
Java 8
Java 8Java 8
Java 8
Sudipta K Paik
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
Sunghyouk Bae
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic Syntax
Adil Jafri
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
Sylvain Wallez
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
Ryan Cuprak
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
Martin Toshev
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentation
nrjoshiee
 
Java Collection
Java CollectionJava Collection
Java Collection
DeeptiJava
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
Naveen Hegde
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
Kyle Smith
 
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
PptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfyPptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
dnthulk
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part I
SivaSankari36
 
New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
Ahmed mar3y
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
Fahad Golra
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic Syntax
Adil Jafri
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
Sylvain Wallez
 

More from Mani Sarkar (6)

How to contribute to Adopt OpenJDK?
How to contribute to Adopt OpenJDK?How to contribute to Adopt OpenJDK?
How to contribute to Adopt OpenJDK?
Mani Sarkar
 
Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
Mani Sarkar
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Mani Sarkar
 
Cli in the browser
Cli in the browserCli in the browser
Cli in the browser
Mani Sarkar
 
Theory of constraints
Theory of constraintsTheory of constraints
Theory of constraints
Mani Sarkar
 
Adopt OpenJDK the past, the present & the future
Adopt OpenJDK  the past, the present & the futureAdopt OpenJDK  the past, the present & the future
Adopt OpenJDK the past, the present & the future
Mani Sarkar
 
How to contribute to Adopt OpenJDK?
How to contribute to Adopt OpenJDK?How to contribute to Adopt OpenJDK?
How to contribute to Adopt OpenJDK?
Mani Sarkar
 
Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
Mani Sarkar
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Mani Sarkar
 
Cli in the browser
Cli in the browserCli in the browser
Cli in the browser
Mani Sarkar
 
Theory of constraints
Theory of constraintsTheory of constraints
Theory of constraints
Mani Sarkar
 
Adopt OpenJDK the past, the present & the future
Adopt OpenJDK  the past, the present & the futureAdopt OpenJDK  the past, the present & the future
Adopt OpenJDK the past, the present & the future
Mani Sarkar
 

Recently uploaded (20)

Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 

Java2 days 2013-lambda

  • 1. Lambda-Tutorial Hands-on-Lab Dmitry Alexandrov Martin Toshev Ivan St. Ivanov Mani Sarkar
  • 2. Contents: • Environment setup • Rules • Tasks: • Internal vs External Iteration • Filtering and Collecting • Mapping • Method References
  • 3. Environment setup: • Java 8 https://jdk8.java.net/lambda/ … build yours from OpenJDK repo • IntelliJ IDEA CE http://www.jetbrains.com/idea/free_java_ide.html Eclipse in current state is NOT recommended! • Vi or emacs for geeks
  • 4. Environment setup: • Take the code • Import as a Maven project • Set Java8 profile (source compatibility) • Run ConfigureYourLambdaBuildOfJdk and see if it compiles!
  • 5. Rules: • We have several classes and test for them. • Fix compilation errors in both classes and tests • Find “// your code here” and write the code! • Run the tests. Try to make them green! • … read the comments.. They are useful!
  • 7. Internal vs External Iteration : • External for (Shape shape: myShapes) { shape.setColor(RED); } • Internal myShapes.forEach(shape -> shape.setColor(RED));
  • 8. Filtering and Collecting : • Java7 for (String s: otherThings) { if (satisfiesSomeCondition(s)) { things.add(s); } } • Java8 otherThings.stream() .filter(s -> satisfiesSomeCondition(s)) .collect(Collectors.toList());
  • 9. Mapping : • Java7 List<String> upperCaseStrings = new ArrayList<>(); for (String s: mixedCaseStrings) { upperCaseStrings.add(s.toUpperCase()); } • Java8 mixedCaseStrings.stream() .map(s -> s.toUpperCase()) .collect(Collectors.toList());
  • 10. Mapping : Lambda expression: myStrings.map(s -> s.toUpperCase()); Using method reference: myStrings.map(String::toUpperCase); Can be used with: • Static method belonging to a particular class • Instance method bound to a particular object instance • Instance method bound to a particular class • Constructor belonging to a particular class
  • 11. Default Method: • Java8 public interface A { default void foo(){ System.out.println("Calling A.foo()"); } } public class Clazz implements A { } Clazz clazz = new Clazz(); clazz.foo(); // Calling A.foo()
  • 12. Default Method: • Java8 public class Clazz2 implements A { @Override public void foo(){ System.out.println("Calling A.foo()"); } } Clazz2 clazz2 = new Clazz2(); clazz2.foo(); // Calling A.foo()