Home » Tag Archives: Java 8 (page 4)

Tag Archives: Java 8

Fail-fast validations using Java 8 streams

java-logo

I’ve lost count of the number of times I’ve seen code which fail-fast validates the state of something, using an approach like:                     public class PersonValidator { public boolean validate(Person person) { boolean valid = person != null; if (valid) valid = person.givenName != null; if (valid) valid = person.familyName != ...

Read More »

Java 8 Stream and Lambda Expressions – Parsing File Example

java-logo

Recently I wanted to extract certain data from an output log. Here’s part of the log file:                   2015-01-06 11:33:03 b.s.d.task [INFO] Emitting: eVentToRequestsBolt __ack_ack [-6722594615019711369 -1335723027906100557] 2015-01-06 11:33:03 c.s.p.d.PackagesProvider [INFO] ===---> Loaded package com.foo.bar 2015-01-06 11:33:04 b.s.d.executor [INFO] Processing received message source: eventToManageBolt:2, stream: __ack_ack, id: {}, [-6722594615019711369 -1335723027906100557] 2015-01-06 11:33:04 ...

Read More »

Stream-Powered Collections Functionality in JDK 8

java-logo

This post presents application of JDK 8 – introduced Streams with Collections to more concisely accomplish commonly desired Collections-related functionality. Along the way, several key aspects of using Java Streams will be demonstrated and briefly explained. Note that although JDK 8 Streams provide potential performance benefits via parallelization support, that is not the focus of this post. The Sample Collection ...

Read More »

How To Process Java Annotations

java-logo

One of the cool new features of Java 8 is the support for lambda expressions. Lambda expressions lean heavily on the FunctionalInterface annotation. In this post, we’ll look at annotations and how to process them so you can implement your own cool features. Annotations Annotations were added in Java 5. The Java language comes with some predefined annotations, but you ...

Read More »

Testing JVM server-side JavaScript with Jasmine, Spock and Nashorn

java-logo

JavaScript usage is not limited to client-side code in browser or NodeJS powered server-side code. Many JVM based projects are using it as internal scripting language. Testing this sort of functionality is neither straightforward nor standard. In this post I intend to demonstrate an approach for testing JavaScript in server-side JVM environment using mature tools like Jasmine, Spock and Nashorn. ...

Read More »

Java 8 StringJoiner

java-logo

At the release of Java 8 the most attention went to the Lamda’s, the new Date API and the Nashorn Javascript engine. In the shade of these, there are smaller but also interesting changes. Amongst them is the introduction of a StringJoiner. The StringJoiner is a utility to delimit a list of characters or strings. You may recognize the code below: ...

Read More »

Really Too Bad that Java 8 Doesn’t Have Iterable.stream()

java-logo

This is one of the more interesting recent Stack Overflow questions: Why does Iterable not provide stream() and parallelStream() methods? At first, it might seem intuitive to make it straight-forward to convert an Iterable into a Stream, because the two are really more or less the same thing for 90% of all use-cases. Granted, the expert group had a strong ...

Read More »

One Jar To Rule Them All: Arquillian + Java 8

java-interview-questions-answers

With Java 8, a lot of new language improvements have been implemented for making life of developer easier. In my opinion, one of the greatest things it has Java 8 is that in some situations developed code looks more beautiful that using prior approaches, and I am referring in Lambdas and Method references. This post is not about learning these ...

Read More »

Java SE 8 new features tour: Traversing, filtering, processing collection, & methods enhancements with Lambda

java-logo

In this article of the “Java SE 8 new features tour” series, we will deep dig into explanation, and exploring the code, on how to traverse the collections using lambda expression and with method references, filtering them with predicate interface, implementing default methods in interfaces, and finally implementing static methods in interfaces. In the previous article “Functional programming with Lambda ...

Read More »

First Java 8 Experience

java-logo

Like the rest of the world, I fell deeply in love with Slack. Why? Lot of reasons, but the main one is it provides a new means of really building the SDLC process around communication rather than tools. Which do you think is more common these days, the team of disorganized nitwits meandering around in the wilderness unable to execute ...

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