524 * <tt>true</tt> if the given object is also a map and the two maps
525 * represent the same mappings. More formally, two maps <tt>m1</tt> and
526 * <tt>m2</tt> represent the same mappings if
527 * <tt>m1.entrySet().equals(m2.entrySet())</tt>. This ensures that the
528 * <tt>equals</tt> method works properly across different implementations
529 * of the <tt>Map</tt> interface.
530 *
531 * @param o object to be compared for equality with this map
532 * @return <tt>true</tt> if the specified object is equal to this map
533 */
534 boolean equals(Object o);
535
536 /**
537 * Returns the hash code value for this map. The hash code of a map is
538 * defined to be the sum of the hash codes of each entry in the map's
539 * <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt>
540 * implies that <tt>m1.hashCode()==m2.hashCode()</tt> for any two maps
541 * <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of
542 * {@link Object#hashCode}.
543 *
544 * @return the hash code value for this map
545 * @see Map.Entry#hashCode()
546 * @see Object#equals(Object)
547 * @see #equals(Object)
548 */
549 int hashCode();
550
551 // Defaultable methods
552
553 /**
554 * Returns the value to which the specified key is mapped,
555 * or {@code defaultValue} if this map contains no mapping
556 * for the key.
557 *
558 * <p>The default implementation makes no guarantees about synchronization
559 * or atomicity properties of this method. Any implementation providing
560 * atomicity guarantees must override this method and document its
561 * concurrency properties.
562 *
563 * @param key the key whose associated value is to be returned
|
524 * <tt>true</tt> if the given object is also a map and the two maps
525 * represent the same mappings. More formally, two maps <tt>m1</tt> and
526 * <tt>m2</tt> represent the same mappings if
527 * <tt>m1.entrySet().equals(m2.entrySet())</tt>. This ensures that the
528 * <tt>equals</tt> method works properly across different implementations
529 * of the <tt>Map</tt> interface.
530 *
531 * @param o object to be compared for equality with this map
532 * @return <tt>true</tt> if the specified object is equal to this map
533 */
534 boolean equals(Object o);
535
536 /**
537 * Returns the hash code value for this map. The hash code of a map is
538 * defined to be the sum of the hash codes of each entry in the map's
539 * <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt>
540 * implies that <tt>m1.hashCode()==m2.hashCode()</tt> for any two maps
541 * <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of
542 * {@link Object#hashCode}.
543 *
544 * @apiNote Support for calculation of hash code by self referential
545 * Maps (they either directly or indirectly contain themselves as a key) is
546 * optional. Few Map implementations support calculation of hash code for
547 * self referential instances.
548 *
549 * @return the hash code value for this map
550 * @see Map.Entry#hashCode()
551 * @see Object#equals(Object)
552 * @see #equals(Object)
553 */
554 int hashCode();
555
556 // Defaultable methods
557
558 /**
559 * Returns the value to which the specified key is mapped,
560 * or {@code defaultValue} if this map contains no mapping
561 * for the key.
562 *
563 * <p>The default implementation makes no guarantees about synchronization
564 * or atomicity properties of this method. Any implementation providing
565 * atomicity guarantees must override this method and document its
566 * concurrency properties.
567 *
568 * @param key the key whose associated value is to be returned
|