Home » Tag Archives: Lambdas (page 2)

Tag Archives: Lambdas

lambdas and side effects

java-logo

Overview Java 8 has added features such as lambdas and type inference. This makes the language less verbose and cleaner, however it comes with more side effects as you don’t have to be as explicit in what you are doing. The return type of a lambda matters Java 8 infers the type of a closure. One way it does this ...

Read More »

Clean JUnit Throwable-Tests with Java 8 Lambdas

junit-logo

Recently I was involved in a short online discussion on twitter and google+ which concerned the question why the arrival of Java 8 Lambda expressions makes the catch-exception library1 obsolete. This was triggered by a brief announcement that the library won’t be longer maintained as lambdas will make it redundant. The answer I came up with at that time has ...

Read More »

Mapping your Entities to DTO’s Using Java 8 Lambda expressions

java-logo

We all facing the cluttered overhead code when we need to convert our DTO’S to Entities(Hibernate Entities, etc..) and backwards. In my example ill demonstrate how the code is getting much shorter with Java 8. Let’s create the Target DTO:             public class ActiveUserListDTO { public ActiveUserListDTO() { } public ActiveUserListDTO(UserEntity userEntity) { this.username = ...

Read More »

Lambda Expressions and Stream API: basic examples

java-logo

This blog post contains a list of basic Lambda expressions and Stream API examples I used in a live coding presentation I gave in June 2014 at Java User Group – Politechnica Gedanensis (Technical University of Gdańsk) and at Goyello. Lambda Expressions Syntax The most common example:     Runnable runnable = () -> System.out.println("Hello!"); Thread t = new Thread(runnable); ...

Read More »

Playing with Java 8 – Lambdas, Paths and Files

java-logo

I needed to read a whole bunch of files recently and instead of just grabbing my old FileUtils.java that I and probably most developers have and then copy from project to project, I decided to have quick look at how else to do it… Yes, I know there is Commons IO and Google IO, why would I even bother?  They ...

Read More »

Java 8 Features Tutorial – The ULTIMATE Guide (PDF Download)

java-logo

EDITORIAL NOTE: It’s been a while since Java 8 is out in the public and everything points to the fact that this is a really major release. We have provided an abundance of tutorials here at Java Code Geeks, like Playing with Java 8 – Lambdas and Concurrency, Java 8 Date Time API Tutorial : LocalDateTime and Abstract Class Versus ...

Read More »

Playing with Java 8 – Lambdas and Concurrency

java-logo

So Java 8 was released a while back, with a ton of features and changes. All us Java zealots have been waiting for this for ages, all the way back to from when they originally announced all the great features that will be in Java 7, which ended up being pulled. I have just recently had the time to actually ...

Read More »

Clean Synchronization Using ReentrantLock and Lambdas

java-logo

Recently I was reading an informative post about the differences between synchronized vs ReentrantLock by Javin Paul1. He emphasises on the advantages of the latter, but does not withhold some downsides, which are related to the cumbersome try-finally block needed for proper usage. While agreeing on his statements I brooded about a thought, that always bothers me when it comes ...

Read More »

Creating your own loop structure in Java 8 lambda

java-logo

Java doesn’t have an easy construct of repeat something N number of times. We can make a for loop of course, but many times we don’t even care about the variable that we created in the loop. We just want repeat N times of some code and that’s it. With the lambda available in Java 8, you may attempt something ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close