@@ -0,0 +1,1201 @@
+package com.levelup.java.date.adjuster;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.time.LocalDate;%0Aimport java.time.Month;%0Aimport java.time.temporal.TemporalAdjusters;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * This java example will demonstrate predefined java 8 year%0A * adjusters.%0A * %0A * @author Justin Musgrove%0A * @see %3Ca href='http://www.leveluplunch.com//'%3E%3C/a%3E%0A */%0Apublic class YearAdjusters %7B%0A%0A%09@Test%0A%09public void first_day_of_next_year() %7B%0A%0A%09%09LocalDate date = LocalDate.of(1971, Month.AUGUST, 11);%0A%0A%09%09LocalDate firstDayOfMonth = date.with(TemporalAdjusters%0A%09%09%09%09.firstDayOfNextYear());%0A%0A%09%09assertEquals(LocalDate.of(1972, Month.JANUARY, 1), firstDayOfMonth);%0A%09%7D%0A%09%0A%09@Test%0A%09public void first_day_of_year() %7B%0A%0A%09%09LocalDate date = LocalDate.of(1971, Month.SEPTEMBER, 11);%0A%0A%09%09LocalDate firstDayOfMonth = date.with(TemporalAdjusters%0A%09%09%09%09.firstDayOfYear());%0A%0A%09%09assertEquals(LocalDate.of(1971, Month.JANUARY, 1), firstDayOfMonth);%0A%09%7D%0A%09%0A%09@Test%0A%09public void last_day_of_year() %7B%0A%0A%09%09LocalDate date = LocalDate.of(1971, Month.OCTOBER, 11);%0A%0A%09%09LocalDate firstDayOfMonth = date%0A%09%09%09%09.with(TemporalAdjusters.lastDayOfYear());%0A%0A%09%09assertEquals(LocalDate.of(1971, Month.DECEMBER, 31), firstDayOfMonth);%0A%09%7D%0A%09%0A%7D%0A

add predefined java 8 year adjusters