New Date and Time API in Java 8

Handling time and date in Java has always been somewhat complicated. At least until the new Date and Time API was published along with Java 8 release. Before that, developers had to struggle with not so great java.util.Date and java.util.Calendar classes which both had their flaws. In this post, a third in a series introducing new Java 8 language features (see Java 8 Stream API and Lambda expressions tutorial posts), I’m going to present the new Date and Time API in Java 8 and explain why it’s a much better choice than previous date and time APIs.

Read more

Improve your code with Android Annotations support library

Annotations have been a part of Java programming language since JDK version 1.5. Since then, they have constantly gained on popularity and nowadays you probably couldn’t find a class that doesn’t use at least one annotation in its code. There is also a support library available, providing several useful annotations to be used in Android development. In this post, which is the first post of the Android Annotations series, we’ll have a look at what the annotations from Android Support library have to offer.

Read more

Lambda expressions in Android (part 2/2)

In the previous post, lambda expressions in Java 8 have been introduced. In this post I will describe how to enable and use Java 8 language features including lambda expressions in Android development.

Until recently, only Java 7 was officially supported when developing for Android. However, this changes with the release of Android N (Nougat, API version 24) and its official support for Java 8. Before Android N was released however, it was also possible to use an external library called retrolambda which allows to bring lambda expressions support to Java 7 and lower.

Read more