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.
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.
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.
Java 8 brought many new features known up until now mainly from functional programming languages. Among the most interesting ones, there are lambda expressions, default methods, stream API, etc. In this post, let me introduce you to the first of listed — lambda expressions.