Example #1
0
 public int getVotes() {
   votes = 0;
   for (Map.Entry<User, Integer> entry : userVotes.entrySet()) {
     votes += entry.getValue();
   }
   return votes;
 }
Example #2
0
 public boolean equals(Object o) {
   Employee e = (Employee) o;
   Map<String, PhoneNumber> map = e.getPhoneNumbers();
   if (map.size() != phones.size()) return false;
   Collection<Map.Entry<String, PhoneNumber>> entries =
       (Collection<Map.Entry<String, PhoneNumber>>) phones.entrySet();
   for (Map.Entry<String, PhoneNumber> entry : entries) {
     String key = entry.getKey();
     PhoneNumber p = entry.getValue();
     PhoneNumber p0 = map.get(key);
     if (p.getNumber() != p0.getNumber()) return false;
   }
   return true;
 }