In this case, any value added to the preferences list will be validated.Īlso, the specification supports the new Optional type in Java 8: private LocalDate dateOfBirth The validation annotations can also be applied to elements of a collection: List preferences