I believe what you may be looking for is a Map.
enum ContactType {
PERSONAL, BUSINESS
}
...
final Map<ContactType, Set<Contact>> contacts = new HashMap<>();
...
public void...
Type: Posts; User: veeer
I believe what you may be looking for is a Map.
enum ContactType {
PERSONAL, BUSINESS
}
...
final Map<ContactType, Set<Contact>> contacts = new HashMap<>();
...
public void...
What kinds of individual methods? Accessors and mutators for the type? Sure, but I see no benefit over using the constructor to pass your type in.
I see no reason why it shouldn't be exposed to the user, but if you must, just add a constructor parameter and seek adding a type field to the Contact class and add it to the class' constructor. That...
Why should the contact type *not* be apart of the Contact object? There's no real logical alternative... you should be seeking to maximize cohesion while minimizing coupling.