< prev index next >

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

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.util;
  27 
  28 import jdk.internal.misc.SharedSecrets;
  29 
  30 /**
  31  * A specialized {@link Map} implementation for use with enum type keys.  All
  32  * of the keys in an enum map must come from a single enum type that is
  33  * specified, explicitly or implicitly, when the map is created.  Enum maps
  34  * are represented internally as arrays.  This representation is extremely
  35  * compact and efficient.
  36  *
  37  * <p>Enum maps are maintained in the <i>natural order</i> of their keys
  38  * (the order in which the enum constants are declared).  This is reflected
  39  * in the iterators returned by the collections views ({@link #keySet()},
  40  * {@link #entrySet()}, and {@link #values()}).
  41  *
  42  * <p>Iterators returned by the collection views are <i>weakly consistent</i>:
  43  * they will never throw {@link ConcurrentModificationException} and they may
  44  * or may not show the effects of any modifications to the map that occur while
  45  * the iteration is in progress.
  46  *
  47  * <p>Null keys are not permitted.  Attempts to insert a null key will
  48  * throw {@link NullPointerException}.  Attempts to test for the




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.util;
  27 
  28 import jdk.internal.access.SharedSecrets;
  29 
  30 /**
  31  * A specialized {@link Map} implementation for use with enum type keys.  All
  32  * of the keys in an enum map must come from a single enum type that is
  33  * specified, explicitly or implicitly, when the map is created.  Enum maps
  34  * are represented internally as arrays.  This representation is extremely
  35  * compact and efficient.
  36  *
  37  * <p>Enum maps are maintained in the <i>natural order</i> of their keys
  38  * (the order in which the enum constants are declared).  This is reflected
  39  * in the iterators returned by the collections views ({@link #keySet()},
  40  * {@link #entrySet()}, and {@link #values()}).
  41  *
  42  * <p>Iterators returned by the collection views are <i>weakly consistent</i>:
  43  * they will never throw {@link ConcurrentModificationException} and they may
  44  * or may not show the effects of any modifications to the map that occur while
  45  * the iteration is in progress.
  46  *
  47  * <p>Null keys are not permitted.  Attempts to insert a null key will
  48  * throw {@link NullPointerException}.  Attempts to test for the


< prev index next >