title: Map error with function
body: <p>this is what i have so far and what im trying to do i dont know how to access both parts of the split this code is really wrong but i dont know how to do what i want(yes it is for school)</p>
  
  <pre><code>public class Relatives
      {
          private Map&lt;String,Set&lt;String&gt;&gt; map;
  
          /**
           * Constructs a relatives object with an empty map
           */
          public Relatives()
          {
              map = new TreeMap&lt;String,Set&lt;String&gt;&gt;();
          }
  
          /**
           * adds a relationship to the map by either adding a relative to the
           * set of an existing key, or creating a new key within the map
           * @param line a string containing the key person and their relative
           */
              public void setPersonRelative(String line)
  {
      String[] personRelative = line.split(" ");
  
      if(map.containsKey(personRelative[0]))
      {
          map.put(personRelative[0],map.get(personRelative[1])+personRelative[1]);
      }
      else
      {
          map.put(personRelative[0],personRelative[1]);
      }
  }
  </code></pre>
  
  <p>im trying to access the person and add to there current relatives and if the dont exist create a new person with that relative</p>
  
  <p>how would i format it so it returns like this</p>
  
  <pre><code>Dot is related to Chuck Fred Jason Tom
  Elton is related to Linh
  </code></pre>
  
  <p>i have this but get error</p>
  
  <pre><code>public String getRelatives(String person)
  {
      return map.keySet();
  }
  </code></pre>