I've created a new class. It's a map. I need to create a method within the same class for populating it with some test data. No user input required, simply all done in this code. Just a few examples like "Steve" and his interests like "hiking" "golf" but the interests need to be in a list.
The part that's confusing me is populating the list part of the map, i'm not sure how to. interests.put() doesn't seem to work. Can anybody help?
public class Singles
{
// instance variables - replace the example below with your own
private Map<String, List<String>> interests;
/**
* Constructor for objects of class Singles
*/
public Singles()
{
// initialise instance variables
super();
this.interests = new HashMap<>();
}
public void popInterests()
{
//code to go here. CONFUSED
}
}