< prev index next >

src/java.base/share/classes/java/util/EnumMap.java

Print this page

        

@@ -48,11 +48,11 @@
  * <p>Null keys are not permitted.  Attempts to insert a null key will
  * throw {@link NullPointerException}.  Attempts to test for the
  * presence of a null key or to remove one will, however, function properly.
  * Null values are permitted.
 
- * <P>Like most collection implementations <tt>EnumMap</tt> is not
+ * <P>Like most collection implementations {@code EnumMap} is not
  * synchronized. If multiple threads access an enum map concurrently, and at
  * least one of the threads modifies the map, it should be synchronized
  * externally.  This is typically accomplished by synchronizing on some
  * object that naturally encapsulates the enum map.  If no such object exists,
  * the map should be "wrapped" using the {@link Collections#synchronizedMap}

@@ -78,11 +78,11 @@
  */
 public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
     implements java.io.Serializable, Cloneable
 {
     /**
-     * The <tt>Class</tt> object for the enum type of all the keys of this map.
+     * The {@code Class} object for the enum type of all the keys of this map.
      *
      * @serial
      */
     private final Class<K> keyType;
 

@@ -129,11 +129,11 @@
 
     /**
      * Creates an empty enum map with the specified key type.
      *
      * @param keyType the class object of the key type for this enum map
-     * @throws NullPointerException if <tt>keyType</tt> is null
+     * @throws NullPointerException if {@code keyType} is null
      */
     public EnumMap(Class<K> keyType) {
         this.keyType = keyType;
         keyUniverse = getKeyUniverse(keyType);
         vals = new Object[keyUniverse.length];

@@ -142,30 +142,30 @@
     /**
      * Creates an enum map with the same key type as the specified enum
      * map, initially containing the same mappings (if any).
      *
      * @param m the enum map from which to initialize this enum map
-     * @throws NullPointerException if <tt>m</tt> is null
+     * @throws NullPointerException if {@code m} is null
      */
     public EnumMap(EnumMap<K, ? extends V> m) {
         keyType = m.keyType;
         keyUniverse = m.keyUniverse;
         vals = m.vals.clone();
         size = m.size;
     }
 
     /**
      * Creates an enum map initialized from the specified map.  If the
-     * specified map is an <tt>EnumMap</tt> instance, this constructor behaves
+     * specified map is an {@code EnumMap} instance, this constructor behaves
      * identically to {@link #EnumMap(EnumMap)}.  Otherwise, the specified map
      * must contain at least one mapping (in order to determine the new
      * enum map's key type).
      *
      * @param m the map from which to initialize this enum map
-     * @throws IllegalArgumentException if <tt>m</tt> is not an
-     *     <tt>EnumMap</tt> instance and contains no mappings
-     * @throws NullPointerException if <tt>m</tt> is null
+     * @throws IllegalArgumentException if {@code m} is not an
+     *     {@code EnumMap} instance and contains no mappings
+     * @throws NullPointerException if {@code m} is null
      */
     public EnumMap(Map<K, ? extends V> m) {
         if (m instanceof EnumMap) {
             EnumMap<K, ? extends V> em = (EnumMap<K, ? extends V>) m;
             keyType = em.keyType;

@@ -192,15 +192,15 @@
     public int size() {
         return size;
     }
 
     /**
-     * Returns <tt>true</tt> if this map maps one or more keys to the
+     * Returns {@code true} if this map maps one or more keys to the
      * specified value.
      *
      * @param value the value whose presence in this map is to be tested
-     * @return <tt>true</tt> if this map maps one or more keys to this value
+     * @return {@code true} if this map maps one or more keys to this value
      */
     public boolean containsValue(Object value) {
         value = maskNull(value);
 
         for (Object val : vals)

@@ -209,15 +209,15 @@
 
         return false;
     }
 
     /**
-     * Returns <tt>true</tt> if this map contains a mapping for the specified
+     * Returns {@code true} if this map contains a mapping for the specified
      * key.
      *
      * @param key the key whose presence in this map is to be tested
-     * @return <tt>true</tt> if this map contains a mapping for the specified
+     * @return {@code true} if this map contains a mapping for the specified
      *            key
      */
     public boolean containsKey(Object key) {
         return isValidKey(key) && vals[((Enum<?>)key).ordinal()] != null;
     }

@@ -256,13 +256,13 @@
      *
      * @param key the key with which the specified value is to be associated
      * @param value the value to be associated with the specified key
      *
      * @return the previous value associated with specified key, or
-     *     <tt>null</tt> if there was no mapping for key.  (A <tt>null</tt>
+     *     {@code null} if there was no mapping for key.  (A {@code null}
      *     return can also indicate that the map previously associated
-     *     <tt>null</tt> with the specified key.)
+     *     {@code null} with the specified key.)
      * @throws NullPointerException if the specified key is null
      */
     public V put(K key, V value) {
         typeCheck(key);
 

@@ -277,13 +277,13 @@
     /**
      * Removes the mapping for this key from this map if present.
      *
      * @param key the key whose mapping is to be removed from the map
      * @return the previous value associated with specified key, or
-     *     <tt>null</tt> if there was no entry for key.  (A <tt>null</tt>
+     *     {@code null} if there was no entry for key.  (A {@code null}
      *     return can also indicate that the map previously associated
-     *     <tt>null</tt> with the specified key.)
+     *     {@code null} with the specified key.)
      */
     public V remove(Object key) {
         if (!isValidKey(key))
             return null;
         int index = ((Enum<?>)key).ordinal();

@@ -642,16 +642,16 @@
 
     // Comparison and hashing
 
     /**
      * Compares the specified object with this map for equality.  Returns
-     * <tt>true</tt> if the given object is also a map and the two maps
+     * {@code true} if the given object is also a map and the two maps
      * represent the same mappings, as specified in the {@link
      * Map#equals(Object)} contract.
      *
      * @param o the object to be compared for equality with this map
-     * @return <tt>true</tt> if the specified object is equal to this map
+     * @return {@code true} if the specified object is equal to this map
      */
     public boolean equals(Object o) {
         if (this == o)
             return true;
         if (o instanceof EnumMap)

@@ -756,11 +756,11 @@
     }
 
     private static final long serialVersionUID = 458661240069192865L;
 
     /**
-     * Save the state of the <tt>EnumMap</tt> instance to a stream (i.e.,
+     * Save the state of the {@code EnumMap} instance to a stream (i.e.,
      * serialize it).
      *
      * @serialData The <i>size</i> of the enum map (the number of key-value
      *             mappings) is emitted (int), followed by the key (Object)
      *             and value (Object) for each key-value mapping represented

@@ -785,11 +785,11 @@
             }
         }
     }
 
     /**
-     * Reconstitute the <tt>EnumMap</tt> instance from a stream (i.e.,
+     * Reconstitute the {@code EnumMap} instance from a stream (i.e.,
      * deserialize it).
      */
     @SuppressWarnings("unchecked")
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException
< prev index next >