JAVA 8 / NOTES</>↗Java 831 Jan 2016
In this example we will learn how to convert the old java.util.Date and java.util.Calendar objects to the new Date Time introduced in Java 8. The first method in the code snippet below dateToNewDate() show conversion of java.util.Date while the calendarToNewDate() show the conversion of java.util.Calendar. The java.util.Date and java.util.Calendar provide a toInstant() method to convert […]
JAVA 8 / NOTES</>↗Java 831 Jan 2016
In this example we will learn how to get the date of the first particular day that fall after a specific date. In the code snippet below we will find the first Friday that fall after the new year of 2021. First let’s create a LocalDate object that represent the new year of 2021. We […]
JAVA DATE TIME API / NOTES</>↗Java Date Time API29 Jan 2016
The new Java 8 java.time.LocalDate class provide a plus() and minus() methods to add or subtract an amount of period to or from the LocalDate object. The period is represented using the java.time.Period class. To create an instance of Period we can use the of(), ofDays(), ofWeeks(), ofMonths() and ofYears() methods. Let’s see an example […]
JAVA 8 / NOTES</>↗Java 821 Jan 2016
In this example you’ll learn how to use the java.time.Period class (from Java 8) to calculate difference between two dates. Using Period.between() method will give us difference between two dates in years, months and days period. Beside using the Period class, we also use the ChronoUnit enum to calculate difference between two dates. We use […]
GRADLE / NOTES</>↗Gradle21 Dec 2015
In this post we will learn how to install Gradle in OS X. The following steps will guide our installation process to make Gradle available in our OS X machine. But before we start let’s take a look at the definition from wikipedia about Gradle. Gradle is an open source build automation system that builds […]
CORE API / NOTES</>↗Core API20 Dec 2015
This example will show you how to implement the equals() and hashCode() object using java.util.Objects class. The Objects class provides a set of utility methods to work with object such as comparing two objects for equality and calculating the hashcode. Other methods include object null check methods, object to string method, etc. To demonstrate equals() […]