ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/AbstractMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/AbstractMap.java (file contents):
Revision 1.10 by jsr166, Mon May 16 05:03:18 2005 UTC vs.
Revision 1.13 by jsr166, Mon Jun 20 18:02:22 2005 UTC

# Line 6 | Line 6
6   */
7  
8   package java.util;
9 + import java.util.*; // for javadoc (till 6280605 is fixed)
10   import java.util.Map.Entry;
11  
12   /**
# Line 404 | Line 405 | public abstract class AbstractMap<K,V> i
405  
406          if (!(o instanceof Map))
407              return false;
408 <        Map<K,V> t = (Map<K,V>) o;
409 <        if (t.size() != size())
408 >        Map<K,V> m = (Map<K,V>) o;
409 >        if (m.size() != size())
410              return false;
411  
412          try {
# Line 415 | Line 416 | public abstract class AbstractMap<K,V> i
416                  K key = e.getKey();
417                  V value = e.getValue();
418                  if (value == null) {
419 <                    if (!(t.get(key)==null && t.containsKey(key)))
419 >                    if (!(m.get(key)==null && m.containsKey(key)))
420                          return false;
421                  } else {
422 <                    if (!value.equals(t.get(key)))
422 >                    if (!value.equals(m.get(key)))
423                          return false;
424                  }
425              }
# Line 468 | Line 469 | public abstract class AbstractMap<K,V> i
469       * appended.  Finally a right brace is appended.  A string is obtained
470       * from the stringbuffer, and returned.
471       *
472 <     * @return a String representation of this map.
472 >     * @return a String representation of this map
473       */
474      public String toString() {
475 <        StringBuffer buf = new StringBuffer();
476 <        buf.append("{");
475 >        StringBuilder sb = new StringBuilder();
476 >        sb.append("{");
477  
478          Iterator<Entry<K,V>> i = entrySet().iterator();
479          boolean hasNext = i.hasNext();
# Line 481 | Line 482 | public abstract class AbstractMap<K,V> i
482              K key = e.getKey();
483              V value = e.getValue();
484              if (key == this)
485 <                buf.append("(this Map)");
485 >                sb.append("(this Map)");
486              else
487 <                buf.append(key);
488 <            buf.append("=");
487 >                sb.append(key);
488 >            sb.append("=");
489              if (value == this)
490 <                buf.append("(this Map)");
490 >                sb.append("(this Map)");
491              else
492 <                buf.append(value);
492 >                sb.append(value);
493              hasNext = i.hasNext();
494              if (hasNext)
495 <                buf.append(", ");
495 >                sb.append(", ");
496          }
497  
498 <        buf.append("}");
499 <        return buf.toString();
498 >        sb.append("}");
499 >        return sb.toString();
500      }
501  
502      /**
# Line 555 | Line 556 | public abstract class AbstractMap<K,V> i
556           * Creates an entry representing the same mapping as the
557           * specified entry.
558           *
559 <         * @param entry the entry to copy.
559 >         * @param entry the entry to copy
560           */
561          public SimpleEntry(Entry<? extends K, ? extends V> entry) {
562              this.key   = entry.getKey();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines