Wednesday, 15 May 2013

Launching Into Lambdas

Over the last few months I have had loads of fun learning about "Closures" or "Lambdas" in Java 8. For anyone else interested, here is a collection of resources that maybe handy! :)

Java One 2012 - Jump Starting Lambda
http://www.myexpospace.com/JavaOne2012/SessionFiles/CON5089_PDF_5089_0001.pdf

This is a really in-depth presentation that goes a lot into the motivation behind Lambdas. It contains pretty much all the information you need to get started but I'd perhaps go for a shorter/simpler presentation if you want to get started quicker. Maurice's talk below is great for this! xD

DevOxx UK 2013 - Collections After Eight by Maurice Naftalin
http://www.parleys.com/play/516436e9e4b09b60aec89cf2/chapter8/about

I was actually lucky enough to attend this talk and it was my first real exposure to Lambdas. The actual talk should hopefully be up on Parleys soon but the slides are available. Really recommend this as Maurice explains things beautifully.

Steams API Cheatsheet
I'm going to have to put together one for this! For now, Maurice's talk above has a lovely slide "Some Steam Methods" (just after the middle) which contains a brilliant table explaining the stream methods and the lambdas they take.

For now my best tip is to download IntelliJ IDEA 12 which has absolutely brilliant lambda support. ALT+ENTER is your friend! A great way to learn lambdas is to understand how those anonymous inner classes you right can be "lambda-rised" by IntelliJ!

GitHub - Lambda tutorial by Graham Allan
https://github.com/AdoptOpenJDK/lambda-tutorial

Graham has spent some time to put together an awesome tutorial for Lambdas, available on GitHub! Martijn has contributed to this and given it the thumbs up so it must be awesome, right?! :P

GitHub - Playing Parallel Stream + Simple Benchmarking
https://github.com/arkangelofkaos/CodeDojo21_RandomNumbers

Here is one of my late night, post Code Dojo hacks I threw together. I experimented a little with Parallel Streams (hurray for simpler concurrency), doing a very simple and most likely flawed benchmark on the performance of different sorting algorithms.

GitHub - Using Collections Streams
https://github.com/arkangelofkaos/CodeDojo22_Checkout

Another Code Dojo inspired hack, except this time it actually makes sense and it really highlights a real use case for Collection Streams. I didn't complete the code for everything we did in the Kata but I think it covers the core of it well.

No comments:

Post a Comment