Exemplo n.º 1
0
 /**
  * Compares the specified Object with this Dictionary for equality,
  *
  * @return true if the specified Object is equal to this Dictionary.
  */
 public synchronized boolean equals(Object o) {
   if (o == this) return true;
   if (!(o instanceof Dictionary)) return false;
   Dictionary dict = (Dictionary) o;
   int max = size();
   if (dict.size() != max) return false;
   Enumeration k = keys();
   Enumeration e = elements();
   for (int i = 0; i < max; i++) {
     Object key = k.nextElement();
     Object value = e.nextElement();
     if (!value.equals(dict.get(key))) {
       return false;
     }
   }
   return true;
 }
 public int size() {
   return headers.size();
 }