Search:

Type: Posts; User: veeer

Search: Search took 0.10 seconds.

  1. Replies
    11
    Views
    1,989

    Re: Trouble with an array

    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...
  2. Replies
    11
    Views
    1,989

    Re: Trouble with an array

    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.
  3. Replies
    11
    Views
    1,989

    Re: Trouble with an array

    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...
  4. Replies
    11
    Views
    1,989

    Re: Trouble with an array

    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.
Results 1 to 4 of 4