/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Removes a mapping with the specified key from this {@code EnumMap}. * * @param key * the key of the mapping to remove. * @return the value of the removed mapping or {@code null} if no mapping * for the specified key was found. * @throws UnsupportedOperationException * if removing from this {@code EnumMap} is not supported. */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); if (hasMapping[keyOrdinal]) { hasMapping[keyOrdinal] = false; mappingsCount--; } V oldValue = (V) values[keyOrdinal]; values[keyOrdinal] = null; return oldValue; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns whether this {@code EnumMap} contains the specified key. * * @param key * the key to search for. * @return {@code true} if this {@code EnumMap} contains the specified key, * {@code false} otherwise. */ @Override public boolean containsKey(Object key) { if (isValidKeyType(key)) { int keyOrdinal = ((Enum) key).ordinal(); return hasMapping[keyOrdinal]; } return false; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Returns the value of the mapping with the specified key. * * @param key * the key. * @return the value of the mapping with the specified key, or {@code null} * if no mapping for the specified key is found. */ @Override @SuppressWarnings("unchecked") public V get(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); return (V) values[keyOrdinal]; }
/** * Removes a mapping with the specified key from this {@code EnumMap}. * * @param key * the key of the mapping to remove. * @return the value of the removed mapping or {@code null} if no mapping * for the specified key was found. * @throws UnsupportedOperationException * if removing from this {@code EnumMap} is not supported. */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); if (hasMapping[keyOrdinal]) { hasMapping[keyOrdinal] = false; mappingsCount--; } V oldValue = (V) values[keyOrdinal]; values[keyOrdinal] = null; return oldValue; }
/** * Removes a mapping with the specified key from this {@code EnumMap}. * * @param key * the key of the mapping to remove. * @return the value of the removed mapping or {@code null} if no mapping * for the specified key was found. * @throws UnsupportedOperationException * if removing from this {@code EnumMap} is not supported. */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); if (hasMapping[keyOrdinal]) { hasMapping[keyOrdinal] = false; mappingsCount--; } V oldValue = (V) values[keyOrdinal]; values[keyOrdinal] = null; return oldValue; }
/** * Removes a mapping with the specified key from this {@code EnumMap}. * * @param key * the key of the mapping to remove. * @return the value of the removed mapping or {@code null} if no mapping * for the specified key was found. * @throws UnsupportedOperationException * if removing from this {@code EnumMap} is not supported. */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { if (!isValidKeyType(key)) { return null; } int keyOrdinal = ((Enum) key).ordinal(); if (hasMapping[keyOrdinal]) { hasMapping[keyOrdinal] = false; mappingsCount--; } V oldValue = (V) values[keyOrdinal]; values[keyOrdinal] = null; return oldValue; }