Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Locates person in this house.
- *
- * @param person Person of interest
- * @return room where the person is located,
- * null if the person is not in the house
- */
- public Room whereIs(Person person){
- for(Room r : personMap.keySet()){
- List<Person> p = new ArrayList<Person>();
- p.addAll(personMap.get(r));
- if(p.contains(person)){
- return r ;
- }
- p.clear();
- }
- return null; //p malo by byt null, ak nie je, vrati sa true, co je v cykle.
- }
Add Comment
Please, Sign In to add comment