Java Reference
In-Depth Information
applications. In particular, support for Lambda expressions and streams that was added in Java 8 works very well
using the JavaFX runtime on the Raspberry Pi.
A nice example of this is the Mary Had a Little Lambda project. This project, which is a JavaFX answer on
the popular “Mary Had a Little Lamb” song, is a typical showcase for Lambda expressions and the stream API in
a JavaFX application. The code is maintained by Stephen Chin in GitHub at https://github.com/steveonjava/
MaryHadALittleLambda/tree/master/src/sample .
The code contains the necessary files to open it as a NetBeans project, but it can also be compiled, packaged, and
executed using the command-line ant tool. You can get a local copy of the code by executing
git clone https://github.com/steveonjava/MaryHadALittleLambda.git
You need a git client on your system to retrieve the code. in case you don't have a git client, you can
easily install this. on linux, this is done using sudo apt-get install git . on Windows, the download Url is
http://git-scm.com/download/win . on macoS, the download Url is http://git-scm.com/download/mac .
Note
After you retrieve the code, you can build and run it on the desktop with a single command:
ant
if you don't have the ant build tool, you can download it for your operating system at
http://ant.apache.org/bindownload.cgi .
Note
Alternatively, you can open the project in NetBeans, and run it there similarly to the other NetBeans projects in
the previous chapters of this topic.
Running the code on a desktop system results in the output shown in Figure 12-5 .
 
 
Search WWH ::




Custom Search