Labs
We are going to modify classes to use Java 8's LocalDate.
Package: DatesAndTimes/com.example.datesandtimes.labs
Solutions: DatesAndTimes/com.example.datesandtimes.solutions.labs
- Modify
USState: instead ofString, make theadmissionDateaLocalDate, updating getters, setters, and constructors as needed.
(Solution: USState.java)
- Modify
USStatesApp: inloadStatesMapFromFile, the date field must now be converted to aLocalDatebefore theUSStateconstructor is called. At the top of the method define aDateTimeFormatterwith a pattern for parsing the date strings in the file. In the loop, use the formatter to parse the string into aLocalDateto pass to theUSStateconstructor.
(Solution: USStatesApp.java)