SlideShare a Scribd company logo
Raspberry Pi Gaming 4 Kids
Stephen Chin (@steveonjava)
What Runs Java?
What Runs Java?
Java and 3G in a Tiny Package
>

Cinterion EHS5
Really Tiny…

18.8mm

27.6mm
http://upload.wikimedia.org/wikipedia/commons/3/3d/Cloud_forest_Ecuador.jpg
Have Java With Your Dessert
Raspberry Pi

=
Pis are Affordable

$35
Pis are Affordable
A Cake

Bicycle
(but just 1 wheel)

$35

1 Box of Diapers
Chalkboard Electronics Touchscreen
 10" or 7" Form Factor
 Connects via HDMI/USB
 Tested with JavaFX 8

 10% Exclusive Discount:

G1F0U796Z083
How to Setup Your Pi
>

Step 1: Install Linux

>

Step 2: Download/Copy Java 8 for ARM EA

>

Step 3: Deploy and Run JVM Language Apps

http://steveonjava.com/
javafx-on-raspberry-pi-3-easy-steps/
What Comes in Your Lab Kit
Touch Screen
SD Card
Keyboard
Yellow Box:

1.
2.
3.
4.






Power Adapter
LVDS Cable/Board
Raspberry Pi Model B
Mini-USB Cable (power)
Micro-USB Cable (keyboard)

Please Save All the Packaging for Later
Electronic Safety!
>

Unplug from wall before wiring

>

Get rid of static by touching a metal
surface

>

Don't touch exposed wires/metal

>

Never remove/insert SD Card while
power is on
13
Hooking Up the Pi (Part A)
Important: Connect everything before plugging into the wall

Insert the SD Card in to the Pi

1.


Will appear upside down when looking at the top
of your Pi

Insert the HDMI board into the Pi's HDMI
jack
Connect the Pi power to the HDMI board

2.

3.


Use the Micro USB Cable (short one)

14
Hooking Up the Pi (Part B)
Slide the LCD cable into the back of the display

4.



Side with gold connectors goes up
Be careful, the connector is fragile!

Connect the USB end to one of the Pi's USB
host ports

5.



This provides touch input

Hook up the USB keyboard

6.
1.

Use the Mini USB cable (long one)

Verify connections and plug into power now
15
Is it Working?
>

Should get a bunch of flashing LEDs to indicate booting


>

The LCD screen should light up


>

Boot takes approx 30 seconds
Might be dim if the light sensor is obstructed

And you will should see a Linux boot screen with lots of text

Hacking Time!
Logging In
At the login prompt type your username:
> pi
And enter the password:
> raspberry
Running Your First Application
Change directory to the project folder
> cd MaryHadALittleLambda
Run the build script
> ant
19
Hacking the Code
Run the nano text editor:
> nano src/sample/MapObject.java
Save your changes:
> Control-O Enter
Exit Nano:
> Control-X
Compile/Run:
> ant
Mary Had a Little Lambda

Mary had a little lambda
Whose fleece was white as snow
And everywhere that Mary went
Lambda was sure to go!

https://github.com/steveonjava/MaryHadALittleLambda
Generating Streams
From a collection:
> anyCollection.stream();
Known set of objects:
> Stream.of("bananas", "oranges", "apples");
Numeric range:
> IntStream.range(0, 50)
Iteratively:
> Stream.iterate(Color.RED,
>
c -> Color.hsb(c.getHue() + .1, c.getSaturation(),
>
c.getBrightness()));
22
Let's Create Some Barn Animals!
SpriteView tail = s.getAnimals().isEmpty() ?
s : s.getAnimals().get(s.getAnimals().size() - 1);
Stream.iterate(tail, SpriteView.Lamb::new)
.skip(1).limit(7)
.forEach(s.getAnimals()::add);

23
24
Filtering Streams
Predicate Expression
> public interface Predicate<T> {
>
public boolean test(T t);
> }
Filter out minors
> adults = attendees.filter(a -> a.getAge() >= 1.8)

25
Rainbow-colored Lambs!
s.getAnimals().stream()
.filter(a -> a.getNumber() % 4 == 2)
.forEach(a -> a.setColor(Color.YELLOW));
s.getAnimals().stream()
.filter(a -> a.getNumber() % 4 == 3)
.forEach(a -> a.setColor(Color.CYAN));
s.getAnimals().stream()
.filter(a -> a.getNumber() % 4 == 0)
.forEach(a -> a.setColor(Color.GREEN));
26
27
Filtering Collections
Collection.removeIf
> Removes all elements that match the predicate
List.replaceAll
> In-place filtering and replacement using an unary operator
ObservableCollection.filtered
> Returns a list filtered by a predicate this is also Observable

28
Picky Eaters…
Predicate<SpriteView> pure =
a -> a.getColor() == null;
mealsServed.set(mealsServed.get() +
s.getAnimals().filtered(pure).size()
);
s.getAnimals().removeIf(pure);
29
30
Mapping Streams
Applies a Map Function to each element:
> Function<? super T, ? extends R>
Result: List is the same size, but may be a different type.

31
Single Map
s.getAnimals().setAll(s.getAnimals()
.stream()
.map(sv -> new Eggs(sv.getFollowing())
.collect(Collectors.toList())
);

32
Or a Double Map!
s.getAnimals().setAll(s.getAnimals()
.stream()
.map(SpriteView::getFollowing)
.map(Eggs::new)
.collect(Collectors.toList())
);

33
34
Flat Map
Applies a One-to-Many Map Function to each element:
> Function<? super T, ? extends Stream<? extends R>>
And then flattens the result into a single stream.
Result: The list may get longer and the type may be different.

35
Hatching Eggs
s.getAnimals().setAll(s.getAnimals()
.stream()
.flatMap(SpriteView.Eggs::hatch)
.collect(Collectors.toList())
);

36
37
Reduce
Reduces a list to a single element given:
> Identity: T
> Accumulator: BinaryOperator<T>
Result: List of the same type, but only 1 element left.

38
And the (formerly little) Fox ate them all!
Double mealSize = shepherd.getAnimals()
.stream()
.map(SpriteView::getScaleX)
.reduce(0.0, Double::sum);
setScaleX(getScaleX() + mealSize * .2);
setScaleY(getScaleY() + mealSize * .2);
shepherd.getAnimals().clear();

39
40
Mary Had a Little Lambda Project
>
>

Open-source project to demonstrate lambda features
Visual representation of streams, filters, and maps
https://github.com/steveonjava/MaryHadALittleLambda

41
NightHacking Tour

Stephen Chin (@steveonjava)
http://steveonjava.com/

Real Geeks
Live Hacking
nighthacking.com
Safe Harbor Statement
The preceding is intended to outline our general product
direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
decisions. The development, release, and timing of any
features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.

More Related Content

PPTX
Oracle IoT Kids Workshop
Stephen Chin
 
PPTX
Raspberry pi gaming 4 kids
Stephen Chin
 
PPTX
Java on Raspberry Pi Lab
Stephen Chin
 
PPTX
Devoxx4Kids Lego Workshop
Stephen Chin
 
PPTX
JCrete Embedded Java Workshop
Stephen Chin
 
PPTX
Raspberry Pi with Java (JJUG)
Stephen Chin
 
PPTX
RetroPi Handheld Raspberry Pi Gaming Console
Stephen Chin
 
PDF
Código fuente del software educativo
Leo Chavez Martinez
 
Oracle IoT Kids Workshop
Stephen Chin
 
Raspberry pi gaming 4 kids
Stephen Chin
 
Java on Raspberry Pi Lab
Stephen Chin
 
Devoxx4Kids Lego Workshop
Stephen Chin
 
JCrete Embedded Java Workshop
Stephen Chin
 
Raspberry Pi with Java (JJUG)
Stephen Chin
 
RetroPi Handheld Raspberry Pi Gaming Console
Stephen Chin
 
Código fuente del software educativo
Leo Chavez Martinez
 

What's hot (10)

PDF
Código fuente del software educativo
Leo Chavez Martinez
 
PPTX
Internet of Things Magic Show
Stephen Chin
 
PDF
Remote Notifications
Josef Cacek
 
PPTX
Tensorflow + Keras & Open AI Gym
HO-HSUN LIN
 
PDF
The Ring programming language version 1.9 book - Part 56 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 50 of 196
Mahmoud Samir Fayed
 
DOCX
Gaming partye
ElliotBlack
 
PDF
The Ring programming language version 1.5.4 book - Part 47 of 185
Mahmoud Samir Fayed
 
PDF
Kotlin Generation
Minseo Chayabanjonglerd
 
PDF
The Ring programming language version 1.8 book - Part 56 of 202
Mahmoud Samir Fayed
 
Código fuente del software educativo
Leo Chavez Martinez
 
Internet of Things Magic Show
Stephen Chin
 
Remote Notifications
Josef Cacek
 
Tensorflow + Keras & Open AI Gym
HO-HSUN LIN
 
The Ring programming language version 1.9 book - Part 56 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 50 of 196
Mahmoud Samir Fayed
 
Gaming partye
ElliotBlack
 
The Ring programming language version 1.5.4 book - Part 47 of 185
Mahmoud Samir Fayed
 
Kotlin Generation
Minseo Chayabanjonglerd
 
The Ring programming language version 1.8 book - Part 56 of 202
Mahmoud Samir Fayed
 
Ad

Similar to Raspberry Pi Gaming 4 Kids (Devoxx4Kids) (20)

PDF
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
CanSecWest
 
PPTX
Lambdas puzzler - Peter Lawrey
JAXLondon_Conference
 
PDF
MicroPython for LEGO Spike - introduction
sdoro58
 
PDF
Black Hat Europe 2015 - Time and Position Spoofing with Open Source Projects
Wang Kang
 
PDF
Internet of Things
Pranas Sasnauskas
 
PDF
Getting Started with Raspberry Pi - USC 2013
Tom Paulus
 
PDF
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
Felipe Prado
 
PDF
Fewer cables
acme
 
PPTX
Exploring the Internet of Things Using Ruby
Mike Hagedorn
 
PDF
Bulding a reactive game engine with Spring 5 & Couchbase
Alex Derkach
 
PDF
The Mouse is mightier than the sword
Priyanka Aash
 
PPTX
“Automation Testing for Embedded Systems”
GlobalLogic Ukraine
 
PPTX
Lec_4_1_IntrotoPIG.pptx
vishal choudhary
 
PDF
arduino
murbz
 
PDF
Getting Started with Raspberry Pi - DCC 2013.1
Tom Paulus
 
PDF
Hierarchical free monads and software design in fp
Alexander Granin
 
ODP
Introduction to Raspberry Pi and GPIO
Kris Findlay
 
PDF
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Arnaud Joly
 
PDF
H2O Design and Infrastructure with Matt Dowle
Sri Ambati
 
PDF
Sq lite python tutorial sqlite programming in python
Martin Soria
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
CanSecWest
 
Lambdas puzzler - Peter Lawrey
JAXLondon_Conference
 
MicroPython for LEGO Spike - introduction
sdoro58
 
Black Hat Europe 2015 - Time and Position Spoofing with Open Source Projects
Wang Kang
 
Internet of Things
Pranas Sasnauskas
 
Getting Started with Raspberry Pi - USC 2013
Tom Paulus
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
Felipe Prado
 
Fewer cables
acme
 
Exploring the Internet of Things Using Ruby
Mike Hagedorn
 
Bulding a reactive game engine with Spring 5 & Couchbase
Alex Derkach
 
The Mouse is mightier than the sword
Priyanka Aash
 
“Automation Testing for Embedded Systems”
GlobalLogic Ukraine
 
Lec_4_1_IntrotoPIG.pptx
vishal choudhary
 
arduino
murbz
 
Getting Started with Raspberry Pi - DCC 2013.1
Tom Paulus
 
Hierarchical free monads and software design in fp
Alexander Granin
 
Introduction to Raspberry Pi and GPIO
Kris Findlay
 
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Arnaud Joly
 
H2O Design and Infrastructure with Matt Dowle
Sri Ambati
 
Sq lite python tutorial sqlite programming in python
Martin Soria
 
Ad

More from Stephen Chin (20)

PPTX
DevOps Tools for Java Developers v2
Stephen Chin
 
PPTX
10 Ways Everyone Can Support the Java Community
Stephen Chin
 
PPTX
Java Clients and JavaFX: The Definitive Guide
Stephen Chin
 
PPTX
DevOps Tools for Java Developers
Stephen Chin
 
PPTX
Java Clients and JavaFX - Presented to LJC
Stephen Chin
 
PPTX
JavaFX on Mobile (by Johan Vos)
Stephen Chin
 
PPTX
Confessions of a Former Agile Methodologist (JFrog Edition)
Stephen Chin
 
PPTX
Confessions of a Former Agile Methodologist
Stephen Chin
 
PPTX
Zombie Time - JSR 310 for the Undead
Stephen Chin
 
PPTX
OpenJFX on Android and Devices
Stephen Chin
 
PDF
Java 8 for Tablets, Pis, and Legos
Stephen Chin
 
PDF
DukeScript
Stephen Chin
 
PPTX
Devoxx4Kids NAO Workshop
Stephen Chin
 
PDF
Raspberry Pi Gaming 4 Kids - Dutch Version
Stephen Chin
 
PDF
Mary Had a Little λ (QCon)
Stephen Chin
 
PPTX
Raspberry Pi à la GroovyFX
Stephen Chin
 
PPTX
LUGOD Raspberry Pi Hacking
Stephen Chin
 
PPTX
Moving to the Client - JavaFX and HTML5
Stephen Chin
 
PPTX
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Stephen Chin
 
PPTX
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
Stephen Chin
 
DevOps Tools for Java Developers v2
Stephen Chin
 
10 Ways Everyone Can Support the Java Community
Stephen Chin
 
Java Clients and JavaFX: The Definitive Guide
Stephen Chin
 
DevOps Tools for Java Developers
Stephen Chin
 
Java Clients and JavaFX - Presented to LJC
Stephen Chin
 
JavaFX on Mobile (by Johan Vos)
Stephen Chin
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Stephen Chin
 
Confessions of a Former Agile Methodologist
Stephen Chin
 
Zombie Time - JSR 310 for the Undead
Stephen Chin
 
OpenJFX on Android and Devices
Stephen Chin
 
Java 8 for Tablets, Pis, and Legos
Stephen Chin
 
DukeScript
Stephen Chin
 
Devoxx4Kids NAO Workshop
Stephen Chin
 
Raspberry Pi Gaming 4 Kids - Dutch Version
Stephen Chin
 
Mary Had a Little λ (QCon)
Stephen Chin
 
Raspberry Pi à la GroovyFX
Stephen Chin
 
LUGOD Raspberry Pi Hacking
Stephen Chin
 
Moving to the Client - JavaFX and HTML5
Stephen Chin
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Stephen Chin
 
JavaFX 2 - A Java Developer's Guide (San Antonio JUG Version)
Stephen Chin
 

Recently uploaded (20)

PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
C Programming Basics concept krnppt.pptx
Karan Prajapat
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
agentic-ai-and-the-future-of-autonomous-systems.pdf
siddharthnetsavvies
 
PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
GYTPOL If You Give a Hacker a Host
linda296484
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
C Programming Basics concept krnppt.pptx
Karan Prajapat
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
agentic-ai-and-the-future-of-autonomous-systems.pdf
siddharthnetsavvies
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
GYTPOL If You Give a Hacker a Host
linda296484
 

Raspberry Pi Gaming 4 Kids (Devoxx4Kids)

  • 1. Raspberry Pi Gaming 4 Kids Stephen Chin (@steveonjava)
  • 4. Java and 3G in a Tiny Package > Cinterion EHS5
  • 7. Have Java With Your Dessert Raspberry Pi =
  • 9. Pis are Affordable A Cake Bicycle (but just 1 wheel) $35 1 Box of Diapers
  • 10. Chalkboard Electronics Touchscreen  10" or 7" Form Factor  Connects via HDMI/USB  Tested with JavaFX 8  10% Exclusive Discount: G1F0U796Z083
  • 11. How to Setup Your Pi > Step 1: Install Linux > Step 2: Download/Copy Java 8 for ARM EA > Step 3: Deploy and Run JVM Language Apps http://steveonjava.com/ javafx-on-raspberry-pi-3-easy-steps/
  • 12. What Comes in Your Lab Kit Touch Screen SD Card Keyboard Yellow Box: 1. 2. 3. 4.      Power Adapter LVDS Cable/Board Raspberry Pi Model B Mini-USB Cable (power) Micro-USB Cable (keyboard) Please Save All the Packaging for Later
  • 13. Electronic Safety! > Unplug from wall before wiring > Get rid of static by touching a metal surface > Don't touch exposed wires/metal > Never remove/insert SD Card while power is on 13
  • 14. Hooking Up the Pi (Part A) Important: Connect everything before plugging into the wall Insert the SD Card in to the Pi 1.  Will appear upside down when looking at the top of your Pi Insert the HDMI board into the Pi's HDMI jack Connect the Pi power to the HDMI board 2. 3.  Use the Micro USB Cable (short one) 14
  • 15. Hooking Up the Pi (Part B) Slide the LCD cable into the back of the display 4.   Side with gold connectors goes up Be careful, the connector is fragile! Connect the USB end to one of the Pi's USB host ports 5.  This provides touch input Hook up the USB keyboard 6. 1. Use the Mini USB cable (long one) Verify connections and plug into power now 15
  • 16. Is it Working? > Should get a bunch of flashing LEDs to indicate booting  > The LCD screen should light up  > Boot takes approx 30 seconds Might be dim if the light sensor is obstructed And you will should see a Linux boot screen with lots of text Hacking Time!
  • 17. Logging In At the login prompt type your username: > pi And enter the password: > raspberry
  • 18. Running Your First Application Change directory to the project folder > cd MaryHadALittleLambda Run the build script > ant
  • 19. 19
  • 20. Hacking the Code Run the nano text editor: > nano src/sample/MapObject.java Save your changes: > Control-O Enter Exit Nano: > Control-X Compile/Run: > ant
  • 21. Mary Had a Little Lambda Mary had a little lambda Whose fleece was white as snow And everywhere that Mary went Lambda was sure to go! https://github.com/steveonjava/MaryHadALittleLambda
  • 22. Generating Streams From a collection: > anyCollection.stream(); Known set of objects: > Stream.of("bananas", "oranges", "apples"); Numeric range: > IntStream.range(0, 50) Iteratively: > Stream.iterate(Color.RED, > c -> Color.hsb(c.getHue() + .1, c.getSaturation(), > c.getBrightness())); 22
  • 23. Let's Create Some Barn Animals! SpriteView tail = s.getAnimals().isEmpty() ? s : s.getAnimals().get(s.getAnimals().size() - 1); Stream.iterate(tail, SpriteView.Lamb::new) .skip(1).limit(7) .forEach(s.getAnimals()::add); 23
  • 24. 24
  • 25. Filtering Streams Predicate Expression > public interface Predicate<T> { > public boolean test(T t); > } Filter out minors > adults = attendees.filter(a -> a.getAge() >= 1.8) 25
  • 26. Rainbow-colored Lambs! s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 2) .forEach(a -> a.setColor(Color.YELLOW)); s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 3) .forEach(a -> a.setColor(Color.CYAN)); s.getAnimals().stream() .filter(a -> a.getNumber() % 4 == 0) .forEach(a -> a.setColor(Color.GREEN)); 26
  • 27. 27
  • 28. Filtering Collections Collection.removeIf > Removes all elements that match the predicate List.replaceAll > In-place filtering and replacement using an unary operator ObservableCollection.filtered > Returns a list filtered by a predicate this is also Observable 28
  • 29. Picky Eaters… Predicate<SpriteView> pure = a -> a.getColor() == null; mealsServed.set(mealsServed.get() + s.getAnimals().filtered(pure).size() ); s.getAnimals().removeIf(pure); 29
  • 30. 30
  • 31. Mapping Streams Applies a Map Function to each element: > Function<? super T, ? extends R> Result: List is the same size, but may be a different type. 31
  • 32. Single Map s.getAnimals().setAll(s.getAnimals() .stream() .map(sv -> new Eggs(sv.getFollowing()) .collect(Collectors.toList()) ); 32
  • 33. Or a Double Map! s.getAnimals().setAll(s.getAnimals() .stream() .map(SpriteView::getFollowing) .map(Eggs::new) .collect(Collectors.toList()) ); 33
  • 34. 34
  • 35. Flat Map Applies a One-to-Many Map Function to each element: > Function<? super T, ? extends Stream<? extends R>> And then flattens the result into a single stream. Result: The list may get longer and the type may be different. 35
  • 37. 37
  • 38. Reduce Reduces a list to a single element given: > Identity: T > Accumulator: BinaryOperator<T> Result: List of the same type, but only 1 element left. 38
  • 39. And the (formerly little) Fox ate them all! Double mealSize = shepherd.getAnimals() .stream() .map(SpriteView::getScaleX) .reduce(0.0, Double::sum); setScaleX(getScaleX() + mealSize * .2); setScaleY(getScaleY() + mealSize * .2); shepherd.getAnimals().clear(); 39
  • 40. 40
  • 41. Mary Had a Little Lambda Project > > Open-source project to demonstrate lambda features Visual representation of streams, filters, and maps https://github.com/steveonjava/MaryHadALittleLambda 41
  • 42. NightHacking Tour Stephen Chin (@steveonjava) http://steveonjava.com/ Real Geeks Live Hacking nighthacking.com
  • 43. Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Editor's Notes

  • #2: Feel free to reuse this presentation for your local user groups. Some helpful comments are in the notes section, but feel free to embellish.For more details on JavaFX/Raspberry Pi hacking, check out this post:http://javafx.steveonjava.com/javafx-on-raspberry-pi-3-easy-steps/
  • #3: Java embedded technologies are used in a wide variety of embedded devices. This list is just a small sampling of devices that are currently using Java ME and SE Embedded.
  • #4: Java embedded technologies are used in a wide variety of embedded devices. This list is just a small sampling of devices that are currently using Java ME and SE Embedded.
  • #8: The Raspberry Pi is a consumer-focused, low-cost board. It has a slightly slower ARM processor (ARMv6 700Mhz), but a better GPU than the BeagleBoard. Connectivity is via HDMI/Component, USBx2, Ethernet, and Audio out.
  • #12: And getting JavaFX is as simple as downloading Java 7 (it has been bundled since Java 7u4). Also, it is supported across different desktop platforms (shown in the picture).