Java has multiple types for traversing elements of a source. My last article showed how java.util.Iterator<T> and java.util.ListIterator<T> can be used to traverse data structures like Collections. The concept of iterators is supported since Java 1.2, but got a new relative, java.util.Spliterator<T>, in Java 8.
Iterating data structures is one of the most common tasks. Everyone knows the classics, like for or while. But there are more ways to iterate in Java, providing a lot more functionality.
Dealing with date and time is a cumbersome task in many programming languages. But with Java 8, the JDK provides us with a comprehensive and completely new API, changing the way we deal with time-related concepts.
The three methods, map, filter, and reduce, are the cornerstone of any functional programming. Usually, our data pipelines consist of one or more intermediate operations, transforming (aka mapping) and/or filtering elements, and a terminal operation to gather the data again (aka reducing).
Java is often criticized as being too verbose. One aspect contributing to this characterization is the requirement to specify every type explicitly, which leads to a lot of additional noise. A new way of declaring local variables with less clutter was given to us with JDK 10 and JEP 286: local variable type inference.