Tag: java 8

Java 8 introduces a new date and time API defined inside the java.time package. The key date and time classes defined in this package are LocalDateTime, ZonedDateTime, and OffsetDateTime. OffsetDateTime is an immutable representation of a date-time with an offset from UTC. It stores all date and time fields, to a precision of nanoseconds. For example, you can […]Continue reading

While developing applications, we often need to generate random numbers. Java provides support to generate random numbers primarily through the java.lang.Math and java.util.Random classes. In this post, I will discuss different ways to generate random numbers based on different types of requirements. Random Numbers using the Math Class Java provides the Math class in the […]Continue reading

The majority of the time when you’re working with Maps in Java, you’ll be accessing the map values via the key. There are times you need to walk the map like a list. There’s a number of ways to do this in Java, which have grown over time as the language has evolved. Let’s take […]Continue reading