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.8 by jsr166, Wed Apr 27 07:13:50 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   /**
13   * This class provides a skeletal implementation of the <tt>Map</tt>
14 < * interface, to minimize the effort required to implement this interface. <p>
14 > * interface, to minimize the effort required to implement this interface.
15   *
16 < * To implement an unmodifiable map, the programmer needs only to extend this
16 > * <p>To implement an unmodifiable map, the programmer needs only to extend this
17   * class and provide an implementation for the <tt>entrySet</tt> method, which
18   * returns a set-view of the map's mappings.  Typically, the returned set
19   * will, in turn, be implemented atop <tt>AbstractSet</tt>.  This set should
20   * not support the <tt>add</tt> or <tt>remove</tt> methods, and its iterator
21 < * should not support the <tt>remove</tt> method.<p>
21 > * should not support the <tt>remove</tt> method.
22   *
23 < * To implement a modifiable map, the programmer must additionally override
23 > * <p>To implement a modifiable map, the programmer must additionally override
24   * this class's <tt>put</tt> method (which otherwise throws an
25   * <tt>UnsupportedOperationException</tt>), and the iterator returned by
26   * <tt>entrySet().iterator()</tt> must additionally implement its
27 < * <tt>remove</tt> method.<p>
27 > * <tt>remove</tt> method.
28   *
29 < * The programmer should generally provide a void (no argument) and map
29 > * <p>The programmer should generally provide a void (no argument) and map
30   * constructor, as per the recommendation in the <tt>Map</tt> interface
31 < * specification.<p>
31 > * specification.
32   *
33 < * The documentation for each non-abstract methods in this class describes its
33 > * <p>The documentation for each non-abstract methods in this class describes its
34   * implementation in detail.  Each of these methods may be overridden if the
35 < * map being implemented admits a more efficient implementation.<p>
35 > * map being implemented admits a more efficient implementation.
36   *
37 < * This class is a member of the
37 > * <p>This class is a member of the
38   * <a href="{@docRoot}/../guide/collections/index.html">
39   * Java Collections Framework</a>.
40   *
# Line 59 | Line 60 | public abstract class AbstractMap<K,V> i
60      // Query Operations
61  
62      /**
63 <     * Returns the number of key-value mappings in this map.  If the map
63 <     * contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
64 <     * <tt>Integer.MAX_VALUE</tt>.<p>
63 >     * {@inheritDoc}
64       *
65 <     * This implementation returns <tt>entrySet().size()</tt>.
67 <     *
68 <     * @return the number of key-value mappings in this map.
65 >     * <p>This implementation returns <tt>entrySet().size()</tt>.
66       */
67      public int size() {
68          return entrySet().size();
69      }
70  
71      /**
72 <     * Returns <tt>true</tt> if this map contains no key-value mappings. <p>
76 <     *
77 <     * This implementation returns <tt>size() == 0</tt>.
72 >     * {@inheritDoc}
73       *
74 <     * @return <tt>true</tt> if this map contains no key-value mappings.
74 >     * <p>This implementation returns <tt>size() == 0</tt>.
75       */
76      public boolean isEmpty() {
77          return size() == 0;
78      }
79  
80      /**
81 <     * Returns <tt>true</tt> if this map maps one or more keys to this value.
87 <     * More formally, returns <tt>true</tt> if and only if this map contains
88 <     * at least one mapping to a value <tt>v</tt> such that <tt>(value==null ?
89 <     * v==null : value.equals(v))</tt>.  This operation will probably require
90 <     * time linear in the map size for most implementations of <tt>Map</tt>.<p>
91 <     *
92 <     * This implementation iterates over <tt>entrySet()</tt> searching for an entry
93 <     * with the specified value.  If such an entry is found, <tt>true</tt> is
94 <     * returned.  If the iteration terminates without finding such an entry,
95 <     * <tt>false</tt> is returned.  Note that this implementation requires
96 <     * linear time in the size of the map.
81 >     * {@inheritDoc}
82       *
83 <     * @param value value whose presence in this map is to be tested.
83 >     * <p>This implementation iterates over <tt>entrySet()</tt> searching
84 >     * for an entry with the specified value.  If such an entry is found,
85 >     * <tt>true</tt> is returned.  If the iteration terminates without
86 >     * finding such an entry, <tt>false</tt> is returned.  Note that this
87 >     * implementation requires linear time in the size of the map.
88       *
89 <     * @return <tt>true</tt> if this map maps one or more keys to this value.
89 >     * @throws ClassCastException   {@inheritDoc}
90 >     * @throws NullPointerException {@inheritDoc}
91       */
92      public boolean containsValue(Object value) {
93          Iterator<Entry<K,V>> i = entrySet().iterator();
# Line 118 | Line 108 | public abstract class AbstractMap<K,V> i
108      }
109  
110      /**
111 <     * Returns <tt>true</tt> if this map contains a mapping for the specified
112 <     * key. <p>
111 >     * {@inheritDoc}
112 >     *
113 >     * <p>This implementation iterates over <tt>entrySet()</tt> searching
114 >     * for an entry with the specified key.  If such an entry is found,
115 >     * <tt>true</tt> is returned.  If the iteration terminates without
116 >     * finding such an entry, <tt>false</tt> is returned.  Note that this
117 >     * implementation requires linear time in the size of the map; many
118 >     * implementations will override this method.
119       *
120 <     * This implementation iterates over <tt>entrySet()</tt> searching for an
121 <     * entry with the specified key.  If such an entry is found, <tt>true</tt>
126 <     * is returned.  If the iteration terminates without finding such an
127 <     * entry, <tt>false</tt> is returned.  Note that this implementation
128 <     * requires linear time in the size of the map; many implementations will
129 <     * override this method.
130 <     *
131 <     * @param key key whose presence in this map is to be tested.
132 <     * @return <tt>true</tt> if this map contains a mapping for the specified
133 <     *         key.
134 <     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>
135 <     *         and this map does not permit <tt>null</tt> keys.
120 >     * @throws ClassCastException   {@inheritDoc}
121 >     * @throws NullPointerException {@inheritDoc}
122       */
123      public boolean containsKey(Object key) {
124          Iterator<Map.Entry<K,V>> i = entrySet().iterator();
# Line 153 | Line 139 | public abstract class AbstractMap<K,V> i
139      }
140  
141      /**
142 <     * Returns the value to which this map maps the specified key.  Returns
157 <     * <tt>null</tt> if the map contains no mapping for this key.  A return
158 <     * value of <tt>null</tt> does not <i>necessarily</i> indicate that the
159 <     * map contains no mapping for the key; it's also possible that the map
160 <     * explicitly maps the key to <tt>null</tt>.  The containsKey operation
161 <     * may be used to distinguish these two cases. <p>
162 <     *
163 <     * This implementation iterates over <tt>entrySet()</tt> searching for an
164 <     * entry with the specified key.  If such an entry is found, the entry's
165 <     * value is returned.  If the iteration terminates without finding such an
166 <     * entry, <tt>null</tt> is returned.  Note that this implementation
167 <     * requires linear time in the size of the map; many implementations will
168 <     * override this method.
142 >     * {@inheritDoc}
143       *
144 <     * @param key key whose associated value is to be returned.
145 <     * @return the value to which this map maps the specified key.
144 >     * <p>This implementation iterates over <tt>entrySet()</tt> searching
145 >     * for an entry with the specified key.  If such an entry is found,
146 >     * the entry's value is returned.  If the iteration terminates without
147 >     * finding such an entry, <tt>null</tt> is returned.  Note that this
148 >     * implementation requires linear time in the size of the map; many
149 >     * implementations will override this method.
150       *
151 <     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>
152 <     *         and this map does not permit <tt>null</tt> keys.
175 <     *
176 <     * @see #containsKey(Object)
151 >     * @throws ClassCastException            {@inheritDoc}
152 >     * @throws NullPointerException          {@inheritDoc}
153       */
154      public V get(Object key) {
155          Iterator<Entry<K,V>> i = entrySet().iterator();
# Line 197 | Line 173 | public abstract class AbstractMap<K,V> i
173      // Modification Operations
174  
175      /**
176 <     * Associates the specified value with the specified key in this map
201 <     * (optional operation).  If the map previously contained a mapping for
202 <     * this key, the old value is replaced.<p>
176 >     * {@inheritDoc}
177       *
178 <     * This implementation always throws an
178 >     * <p>This implementation always throws an
179       * <tt>UnsupportedOperationException</tt>.
180       *
181 <     * @param key key with which the specified value is to be associated.
182 <     * @param value value to be associated with the specified key.
183 <     *
184 <     * @return the previous value associated with specified key, or <tt>null</tt>
211 <     *         if there was no mapping for key.  (A <tt>null</tt> return can
212 <     *         also indicate that the map previously associated <tt>null</tt>
213 <     *         with the specified key, if the implementation supports
214 <     *         <tt>null</tt> values.)
215 <     *
216 <     * @throws UnsupportedOperationException if the <tt>put</tt> operation
217 <     *         is not supported by this map.
218 <     * @throws ClassCastException if the class of the specified key or value
219 <     *         prevents it from being stored in this map.
220 <     * @throws IllegalArgumentException if some aspect of this key or value
221 <     *         prevents it from being stored in this map.
222 <     * @throws NullPointerException if this map does not permit <tt>null</tt>
223 <     *         keys or values, and the specified key or value is <tt>null</tt>.
181 >     * @throws UnsupportedOperationException {@inheritDoc}
182 >     * @throws ClassCastException            {@inheritDoc}
183 >     * @throws NullPointerException          {@inheritDoc}
184 >     * @throws IllegalArgumentException      {@inheritDoc}
185       */
186      public V put(K key, V value) {
187          throw new UnsupportedOperationException();
188      }
189  
190      /**
191 <     * Removes the mapping for this key from this map if present (optional
231 <     * operation). <p>
191 >     * {@inheritDoc}
192       *
193 <     * This implementation iterates over <tt>entrySet()</tt> searching for an
193 >     * <p>This implementation iterates over <tt>entrySet()</tt> searching for an
194       * entry with the specified key.  If such an entry is found, its value is
195       * obtained with its <tt>getValue</tt> operation, the entry is removed
196       * from the collection (and the backing map) with the iterator's
197       * <tt>remove</tt> operation, and the saved value is returned.  If the
198       * iteration terminates without finding such an entry, <tt>null</tt> is
199       * returned.  Note that this implementation requires linear time in the
200 <     * size of the map; many implementations will override this method.<p>
200 >     * size of the map; many implementations will override this method.
201       *
202 <     * Note that this implementation throws an
203 <     * <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt> iterator
204 <     * does not support the <tt>remove</tt> method and this map contains a
205 <     * mapping for the specified key.
206 <     *
207 <     * @param key key whose mapping is to be removed from the map.
208 <     * @return the previous value associated with specified key, or <tt>null</tt>
209 <     *         if there was no entry for key.  (A <tt>null</tt> return can
250 <     *         also indicate that the map previously associated <tt>null</tt>
251 <     *         with the specified key, if the implementation supports
252 <     *         <tt>null</tt> values.)
253 <     * @throws UnsupportedOperationException if the <tt>remove</tt> operation
254 <     *         is not supported by this map.
202 >     * <p>Note that this implementation throws an
203 >     * <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt>
204 >     * iterator does not support the <tt>remove</tt> method and this map
205 >     * contains a mapping for the specified key.
206 >     *
207 >     * @throws UnsupportedOperationException {@inheritDoc}
208 >     * @throws ClassCastException            {@inheritDoc}
209 >     * @throws NullPointerException          {@inheritDoc}
210       */
211      public V remove(Object key) {
212          Iterator<Entry<K,V>> i = entrySet().iterator();
# Line 282 | Line 237 | public abstract class AbstractMap<K,V> i
237      // Bulk Operations
238  
239      /**
240 <     * Copies all of the mappings from the specified map to this map
286 <     * (optional operation).  These mappings will replace any mappings that
287 <     * this map had for any of the keys currently in the specified map.<p>
240 >     * {@inheritDoc}
241       *
242 <     * This implementation iterates over the specified map's
242 >     * <p>This implementation iterates over the specified map's
243       * <tt>entrySet()</tt> collection, and calls this map's <tt>put</tt>
244 <     * operation once for each entry returned by the iteration.<p>
244 >     * operation once for each entry returned by the iteration.
245       *
246 <     * Note that this implementation throws an
246 >     * <p>Note that this implementation throws an
247       * <tt>UnsupportedOperationException</tt> if this map does not support
248       * the <tt>put</tt> operation and the specified map is nonempty.
249       *
250 <     * @param t mappings to be stored in this map.
251 <     *
252 <     * @throws UnsupportedOperationException if the <tt>putAll</tt> operation
253 <     *         is not supported by this map.
301 <     * @throws ClassCastException if the class of a key or value in the
302 <     *         specified map prevents it from being stored in this map.
303 <     * @throws IllegalArgumentException if some aspect of a key or value in
304 <     *         the specified map prevents it from being stored in this map.
305 <     * @throws NullPointerException if the specified map is <tt>null</tt>, or if
306 <     *         this map does not permit <tt>null</tt> keys or values, and the
307 <     *         specified map contains <tt>null</tt> keys or values.
250 >     * @throws UnsupportedOperationException {@inheritDoc}
251 >     * @throws ClassCastException            {@inheritDoc}
252 >     * @throws NullPointerException          {@inheritDoc}
253 >     * @throws IllegalArgumentException      {@inheritDoc}
254       */
255 <    public void putAll(Map<? extends K, ? extends V> t) {
256 <        Iterator<? extends Entry<? extends K, ? extends V>> i = t.entrySet().iterator();
255 >    public void putAll(Map<? extends K, ? extends V> m) {
256 >        Iterator<? extends Entry<? extends K, ? extends V>> i = m.entrySet().iterator();
257          while (i.hasNext()) {
258              Entry<? extends K, ? extends V> e = i.next();
259              put(e.getKey(), e.getValue());
# Line 315 | Line 261 | public abstract class AbstractMap<K,V> i
261      }
262  
263      /**
264 <     * Removes all mappings from this map (optional operation). <p>
264 >     * {@inheritDoc}
265       *
266 <     * This implementation calls <tt>entrySet().clear()</tt>.
266 >     * <p>This implementation calls <tt>entrySet().clear()</tt>.
267       *
268 <     * Note that this implementation throws an
268 >     * <p>Note that this implementation throws an
269       * <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt>
270       * does not support the <tt>clear</tt> operation.
271       *
272 <     * @throws UnsupportedOperationException if the <tt>clear</tt> operation
327 <     *         is not supported by this map.
272 >     * @throws UnsupportedOperationException {@inheritDoc}
273       */
274      public void clear() {
275          entrySet().clear();
# Line 342 | Line 287 | public abstract class AbstractMap<K,V> i
287      transient volatile Collection<V> values = null;
288  
289      /**
290 <     * Returns a {@link Set} view of the keys contained in this map.
346 <     * The set is backed by the map, so changes to the map are
347 <     * reflected in the set, and vice-versa.  If the map is modified
348 <     * while an iteration over the set is in progress (except through
349 <     * the iterator's own <tt>remove</tt> operation), the results of
350 <     * the iteration are undefined.  The set supports element removal,
351 <     * which removes the corresponding mapping from the map, via the
352 <     * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
353 <     * <tt>removeAll</tt> <tt>retainAll</tt>, and <tt>clear</tt>
354 <     * operations.  It does not support the add or <tt>addAll</tt>
355 <     * operations.
290 >     * {@inheritDoc}
291       *
292       * <p>This implementation returns a set that subclasses {@link AbstractSet}.
293       * The subclass's iterator method returns a "wrapper object" over this
# Line 400 | Line 335 | public abstract class AbstractMap<K,V> i
335      }
336  
337      /**
338 <     * Returns a {@link Collection} view of the values contained in this map.
404 <     * The collection is backed by the map, so changes to the map are
405 <     * reflected in the collection, and vice-versa.  If the map is
406 <     * modified while an iteration over the collection is in progress
407 <     * (except through the iterator's own <tt>remove</tt> operation),
408 <     * the results of the iteration are undefined.  The collection
409 <     * supports element removal, which removes the corresponding
410 <     * mapping from the map, via the <tt>Iterator.remove</tt>,
411 <     * <tt>Collection.remove</tt>, <tt>removeAll</tt>,
412 <     * <tt>retainAll</tt> and <tt>clear</tt> operations.  It does not
413 <     * support the add or <tt>addAll</tt> operations.
338 >     * {@inheritDoc}
339       *
340       * <p>This implementation returns a collection that subclasses {@link
341       * AbstractCollection}.  The subclass's iterator method returns a
# Line 423 | Line 348 | public abstract class AbstractMap<K,V> i
348       * returned in response to all subsequent calls.  No synchronization is
349       * performed, so there is a slight chance that multiple calls to this
350       * method will not all return the same collection.
426     *
427     * @return a collection view of the values contained in this map.
351       */
352      public Collection<V> values() {
353          if (values == null) {
# Line 465 | Line 388 | public abstract class AbstractMap<K,V> i
388      // Comparison and hashing
389  
390      /**
391 <     * Compares the specified object with this map for equality.  Returns
469 <     * <tt>true</tt> if the given object is also a map and the two maps
470 <     * represent the same mappings.  More formally, two maps <tt>t1</tt> and
471 <     * <tt>t2</tt> represent the same mappings if
472 <     * <tt>t1.keySet().equals(t2.keySet())</tt> and for every key <tt>k</tt>
473 <     * in <tt>t1.keySet()</tt>, <tt> (t1.get(k)==null ? t2.get(k)==null :
474 <     * t1.get(k).equals(t2.get(k))) </tt>.  This ensures that the
475 <     * <tt>equals</tt> method works properly across different implementations
476 <     * of the map interface.<p>
391 >     * {@inheritDoc}
392       *
393 <     * This implementation first checks if the specified object is this map;
393 >     * <p>This implementation first checks if the specified object is this map;
394       * if so it returns <tt>true</tt>.  Then, it checks if the specified
395       * object is a map whose size is identical to the size of this map; if
396       * not, it returns <tt>false</tt>.  If so, it iterates over this map's
# Line 483 | Line 398 | public abstract class AbstractMap<K,V> i
398       * contains each mapping that this map contains.  If the specified map
399       * fails to contain such a mapping, <tt>false</tt> is returned.  If the
400       * iteration completes, <tt>true</tt> is returned.
486     *
487     * @param o object to be compared for equality with this map.
488     * @return <tt>true</tt> if the specified object is equal to this map.
401       */
402      public boolean equals(Object o) {
403          if (o == this)
# Line 493 | 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 504 | 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 521 | Line 433 | public abstract class AbstractMap<K,V> i
433      }
434  
435      /**
436 <     * Returns the hash code value for this map.  The hash code of a map is
437 <     * defined to be the sum of the hash codes of each entry in the map's
438 <     * <tt>entrySet()</tt> view.  This ensures that <tt>t1.equals(t2)</tt>
439 <     * implies that <tt>t1.hashCode()==t2.hashCode()</tt> for any two maps
440 <     * <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of
529 <     * Object.hashCode.<p>
530 <     *
531 <     * This implementation iterates over <tt>entrySet()</tt>, calling
532 <     * <tt>hashCode</tt> on each element (entry) in the Collection, and adding
533 <     * up the results.
436 >     * {@inheritDoc}
437 >     *
438 >     * <p>This implementation iterates over <tt>entrySet()</tt>, calling
439 >     * <tt>hashCode()</tt> on each element (entry) in the set, and
440 >     * adding up the results.
441       *
535     * @return the hash code value for this map.
442       * @see Map.Entry#hashCode()
443       * @see Object#hashCode()
444       * @see Object#equals(Object)
# Line 563 | 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 576 | 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      /**
503       * Returns a shallow copy of this <tt>AbstractMap</tt> instance: the keys
504       * and values themselves are not cloned.
505       *
506 <     * @return a shallow copy of this map.
506 >     * @return a shallow copy of this map
507       */
508      protected Object clone() throws CloneNotSupportedException {
509          AbstractMap<K,V> result = (AbstractMap<K,V>)super.clone();
# Line 650 | 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();
# Line 660 | Line 566 | public abstract class AbstractMap<K,V> i
566          /**
567           * Returns the key corresponding to this entry.
568           *
569 <         * @return the key corresponding to this entry.
569 >         * @return the key corresponding to this entry
570           */
571          public K getKey() {
572              return key;
# Line 669 | Line 575 | public abstract class AbstractMap<K,V> i
575          /**
576           * Returns the value corresponding to this entry.
577           *
578 <         * @return the value corresponding to this entry.
578 >         * @return the value corresponding to this entry
579           */
580          public V getValue() {
581              return value;
# Line 679 | Line 585 | public abstract class AbstractMap<K,V> i
585           * Replaces the value corresponding to this entry with the specified
586           * value.
587           *
588 <         * @param value new value to be stored in this entry.
589 <         * @return the old value corresponding to the entry.
588 >         * @param value new value to be stored in this entry
589 >         * @return the old value corresponding to the entry
590           */
591          public V setValue(V value) {
592              V oldValue = this.value;
# Line 706 | Line 612 | public abstract class AbstractMap<K,V> i
612           * entry's key followed by the equals character ("<tt>=</tt>")
613           * followed by the string representation of this entry's value.
614           *
615 <         * @return a String representation of this map entry.
615 >         * @return a String representation of this map entry
616           */
617          public String toString() {
618              return key + "=" + value;
# Line 740 | Line 646 | public abstract class AbstractMap<K,V> i
646           * Creates an entry representing the same mapping as the
647           * specified entry.
648           *
649 <         * @param entry the entry to copy.
649 >         * @param entry the entry to copy
650           */
651          public SimpleImmutableEntry(Entry<? extends K, ? extends V> entry) {
652              this.key   = entry.getKey();
# Line 750 | Line 656 | public abstract class AbstractMap<K,V> i
656          /**
657           * Returns the key corresponding to this entry.
658           *
659 <         * @return the key corresponding to this entry.
659 >         * @return the key corresponding to this entry
660           */
661          public K getKey() {
662              return key;
# Line 759 | Line 665 | public abstract class AbstractMap<K,V> i
665          /**
666           * Returns the value corresponding to this entry.
667           *
668 <         * @return the value corresponding to this entry.
668 >         * @return the value corresponding to this entry
669           */
670          public V getValue() {
671              return value;
# Line 771 | Line 677 | public abstract class AbstractMap<K,V> i
677           * <tt>UnsupportedOperationException</tt>, as this class implements
678           * an <i>immutable</i> map entry.
679           *
680 <         * @param value new value to be stored in this entry.
680 >         * @param value new value to be stored in this entry
681           * @return (Does not return)
682           * @throws UnsupportedOperationException always
683           */
# Line 797 | Line 703 | public abstract class AbstractMap<K,V> i
703           * entry's key followed by the equals character ("<tt>=</tt>")
704           * followed by the string representation of this entry's value.
705           *
706 <         * @return a String representation of this map entry.
706 >         * @return a String representation of this map entry
707           */
708          public String toString() {
709              return key + "=" + value;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines