Which of the following declaration would be the right one to choose for allocating the right amount of memory. Option 1 has an initial collection capacity of 0 and Option 2 has an initial capacity of 10 and Option 3 doesn't declare anything.
If the underlying ORM provider loads these object eventually, wouldn't it be using a setEmails(..) method to set the values of the Collection. If so, would it make sense to just declare this as in Option 3, so that I can avoid unnecessary memory allocation.
Option 1
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Set<Email> emails = new HashSet<Email>(0);
or
Option 2
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Set<Email> emails = new HashSet<Email>();
or
Option 3
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Set<Email> emails;