Home » Tag Archives: Java 8 (page 15)

Tag Archives: Java 8

java.util.Random in Java 8

java-logo

One of the neat features of java.util.Random class in Java 8 is that it has been retrofitted to now return a random Stream of numbers. For eg, to generate an infinite stream of random doubles between 0(inclusive) and 1(exclusive):               Random random = new Random(); DoubleStream doubleStream = random.doubles(); or to generate an infinite ...

Read More »

Java 8 parameter name at runtime

java-logo

Java 8 will be introducing an easier way to discover the parameter names of methods and constructors. Prior to Java 8, the way to find the parameter names is by turning the debug symbols on at the compilation stage which adds meta information about the parameter names in the generated class files then to extract the information which is complicated ...

Read More »

Skinning in Java8 (JavaFX8)

javafx-logo

There has been some changes in JavaFX8 regarding skinning, the most relevants of which are the new CSS API that allows you to create new CSS properties and pseudo-classes for your controls and the Skin class which has become public. Using CSS you can change a lot of the appearance of a control, but there is only so much you ...

Read More »

A Lesser-Known Java 8 Feature: Generalized Target-Type Inference

java-logo

Going through the list of Java 8 features, Generalized Target-Type Inference struck me as a particularly interesting, lesser-known gem. It looks as though the Java language designers will ease some of the pain that we’ve been having with generics in the past (Java 5-7). Let’s have a look at their example:               class List<E> ...

Read More »

Does Java 8 Still Need LINQ? Or is it Better than LINQ?

java-logo

LINQ was one of the best things that happened to the .NET software engineering ecosystem in a long time. With its introduction of lambda expressions and monads in Visual Studio 2008, it had catapulted the C# language way ahead of Java, which was at version 6 at the time, still discussing the pros and cons of generic type erasure. This achievement ...

Read More »

Java8

java-logo

Java8 isn’t scheduled for for release until March 2014, but early release versions have been available for a while. Some of the most interesting new features are: Streams Functional interfaces Default methods Lambdas Java Time     Streams The new java.util.stream package contains “classes to support functional-style operations on streams of elements”. Streams aren’t a new type of collection and ...

Read More »

instanceof operator and Visitor pattern replacement in Java 8

java-logo

I had a dream where instanceof operator and downcasting were no longer needed but without clumsiness and verbosity of visitor pattern. So I came up with the following DSL syntax:                 Object msg = //... whenTypeOf(msg). is(Date.class). then(date -> println(date.getTime())). is(String.class). then(str -> println(str.length())). is(Number.class). then(num -> println(num.intValue())). orElse(obj -> println("Unknown " + ...

Read More »

What’s new in Java 8 (Part II – What might come)

java-logo

Disclaimer: I do not work for Oracle or represent Oracle in any way. This list of features is not official. This is just part of my research as an “outsider”. This is part II of a three part series of posts. In the first part, I talked about what Oracle has officially let developers know what should come out in ...

Read More »

Deep dive into Optional class API in Java 8

java-logo

We all as Java programmers been through the situation where in we invoke a method to get some value and then instead of directly invoking some methods on the return value, we first have to check that the return value is not null and then invoke the methods on the return value. This has been a pain point which external ...

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