Ethan Smith wrote:Now when a user sends a request to the other person and the person accepts it, the values are passed to the 'locationTime' method but then my question would be how would I iterate through the hashmap so I could get it to say something along the lines of "<User 1> and <User 2> accepted each others request at <loc> at <time>" And then how would I use the 'loc' and 'time' variables from the hashmap? For example I have the name of one of the users and I want to only get the time that the request was accepted).
Well first off, I wouldn't use Strings, because
StringsAreBad (←click).
Set up a class that contains the relevant information (
RequstConfirmation?) and use that as your key - perhaps in more than one map.
Also: LinkedHashMap's retain information in
insertion order for iteration purposes, which you might find useful.
Another possibility is to structure the information the information the way it appears you want to retrieve it, ie:
HashMap<User, HashMap<User, Method>>
Winston