This commit is contained in:
Gary D. Gregory 2024-12-15 10:02:25 -05:00
parent 6b9aa11a03
commit ffe1af2585
1 changed files with 25 additions and 11 deletions

View File

@ -30,63 +30,77 @@ import java.util.Set;
public interface Get<K, V> { public interface Get<K, V> {
/** /**
* Tests for presence of a given key.
*
* @param key key whose presence in this map is to be tested * @param key key whose presence in this map is to be tested
* @return {@code true} if this map contains a mapping for the specified * @return {@code true} if this map contains a mapping for the specified key
* key
* @see java.util.Map#containsKey(Object) * @see java.util.Map#containsKey(Object)
*/ */
boolean containsKey(Object key); boolean containsKey(Object key);
/** /**
* Tests for presence of a given value.
*
* @param value value whose presence in this map is to be tested * @param value value whose presence in this map is to be tested
* @return {@code true} if this map maps one or more keys to the * @return {@code true} if this map maps one or more keys to the specified value
* specified value
* @see java.util.Map#containsValue(Object) * @see java.util.Map#containsValue(Object)
*/ */
boolean containsValue(Object value); boolean containsValue(Object value);
/** /**
* @return a set view of the mappings contained in this map * Gets a set view of the mappings contained in this map.
*
* @return a set view of the mappings contained in this map.
* @see java.util.Map#entrySet() * @see java.util.Map#entrySet()
*/ */
Set<java.util.Map.Entry<K, V>> entrySet(); Set<java.util.Map.Entry<K, V>> entrySet();
/** /**
* Gets a value at a given key.
*
* @param key the key whose associated value is to be returned * @param key the key whose associated value is to be returned
* @return the value to which the specified key is mapped, or * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key
* {@code null} if this map contains no mapping for the key
* @see java.util.Map#get(Object) * @see java.util.Map#get(Object)
*/ */
V get(Object key); V get(Object key);
/** /**
* Tests whether this instance contains any key-value mappings.
*
* @return {@code true} if this map contains no key-value mappings * @return {@code true} if this map contains no key-value mappings
* @see java.util.Map#isEmpty() * @see java.util.Map#isEmpty()
*/ */
boolean isEmpty(); boolean isEmpty();
/** /**
* Gets a view of the keys contained in this map.
*
* @return a set view of the keys contained in this map * @return a set view of the keys contained in this map
* @see java.util.Map#keySet() * @see java.util.Map#keySet()
*/ */
Set<K> keySet(); Set<K> keySet();
/** /**
* Remove a key-value mappings.
*
* @param key key whose mapping is to be removed from the map * @param key key whose mapping is to be removed from the map
* @return the previous value associated with {@code key}, or * @return the previous value associated with {@code key}, or {@code null} if there was no mapping for {@code key}.
* {@code null} if there was no mapping for {@code key}.
* @see java.util.Map#remove(Object) * @see java.util.Map#remove(Object)
*/ */
V remove(Object key); V remove(Object key);
/** /**
* @return the number of key-value mappings in this map * Gets the number of key-value mappings in this map.
*
* @return the number of key-value mappings in this map.
* @see java.util.Map#size() * @see java.util.Map#size()
*/ */
int size(); int size();
/** /**
* @return a collection view of the values contained in this map * Gets a a collection view of the values contained in this map.
*
* @return a collection view of the values contained in this map.
* @see java.util.Map#values() * @see java.util.Map#values()
*/ */
Collection<V> values(); Collection<V> values();