package shouty;

import java.util.*;

public class Shouty {
    private final int MESSAGE_RANGE = 1000;
    private Map<String, Coordinate> locations = new HashMap<String, Coordinate>();
    private Map<String, String> messages = new HashMap<String, String>();

    public void setLocation(String person, Coordinate location) {
      locations.put(person, location);
    }

    public void shout(String person, String message) {
      messages.put(person, message);
    }

    public List<String> getMessagesHeardBy(String listener) {
        List<String> messagesHeard = new ArrayList<String>();

        for (Map.Entry<String, String> entry : messages.entrySet()) {
            messagesHeard.add(entry.getValue());
        }

        return messagesHeard;
    }
}

package shouty;

import java.util.*;

public class Shouty {
    private final int MESSAGE_RANGE = 1000;
    private Map<String, Coordinate> locations = new HashMap<String, Coordinate>();
    private Map<String, String> messages = new HashMap<String, String>();

    public void setLocation(String person, Coordinate location) {
      locations.put(person, location);
    }

    public void shout(String person, String message) {
      messages.put(person, message);
    }

    public Map<String, String> getMessagesHeardBy(String listener) {
        HashMap<String, String> result = new HashMap<String, String>();

        for (Map.Entry<String, String> entry: messages.entrySet()) {
            result.put(entry.getKey(), entry.getValue());
        }

        return result;
    }
}

Change the signature of getMessagesHeardBy
Change the signature of getMessagesHeardBy

This makes the exercise "Add a new scenario" easier, as for those steps
to work, you need to know the identity of the shouter.
