Guest User

Untitled

a guest
May 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /**
  2. * Locates person in this house.
  3. *
  4. * @param person Person of interest
  5. * @return room where the person is located,
  6. * null if the person is not in the house
  7. */
  8. public Room whereIs(Person person){
  9. for(Room r : personMap.keySet()){
  10. List<Person> p = new ArrayList<Person>();
  11. p.addAll(personMap.get(r));
  12.  
  13. if(p.contains(person)){
  14. return r ;
  15. }
  16.  
  17. p.clear();
  18. }
  19. return null; //p malo by byt null, ak nie je, vrati sa true, co je v cykle.
  20.  
  21. }
Add Comment
Please, Sign In to add comment