A Map is a data structure consisting of a set of keys and values in which each key is mapped to a single value. The class of the objects used as keys is declared when the Map is declared, as is the class of the corresponding values. A Map provides helper methods to itera
| 29 | * the key/value pairs. |
| 30 | */ |
| 31 | public interface Map<K,V> { |
| 32 | |
| 33 | /** |
| 34 | * {@code Map.Entry} is a key/value mapping contained in a {@code Map}. |
| 35 | */ |
| 36 | public static interface Entry<K,V> { |
| 37 | /** |
| 38 | * Compares the specified object to this {@code Map.Entry} and returns if they |
| 39 | * are equal. To be equal, the object must be an instance of {@code Map.Entry} and have the |
| 40 | * same key and value. |
| 41 | * |
| 42 | * @param object |
| 43 | * the {@code Object} to compare with this {@code Object}. |
| 44 | * @return {@code true} if the specified {@code Object} is equal to this |
| 45 | * {@code Map.Entry}, {@code false} otherwise. |
| 46 | * @see #hashCode() |
| 47 | */ |
| 48 | public boolean equals(Object object); |
| 49 | |
| 50 | /** |
| 51 | * Returns the key. |
| 52 | * |
| 53 | * @return the key |
| 54 | */ |
| 55 | public K getKey(); |
| 56 | |
| 57 | /** |
| 58 | * Returns the value. |
| 59 | * |
| 60 | * @return the value |
| 61 | */ |
| 62 | public V getValue(); |
| 63 | |
| 64 | /** |
| 65 | * Returns an integer hash code for the receiver. {@code Object} which are |
| 66 | * equal return the same value for this method. |
| 67 | * |
| 68 | * @return the receiver's hash code. |
| 69 | * @see #equals(Object) |
| 70 | */ |
| 71 | public int hashCode(); |
| 72 | |
| 73 | /** |
| 74 | * Sets the value of this entry to the specified value, replacing any |
| 75 | * existing value. |
| 76 | * |
| 77 | * @param object |
| 78 | * the new value to set. |
| 79 | * @return object the replaced value of this entry. |
| 80 | */ |
| 81 | public V setValue(V object); |
| 82 | }; |
| 83 | |
| 84 | /** |
| 85 | * Removes all elements from this {@code Map}, leaving it empty. |
| 86 | * |
| 87 | * @throws UnsupportedOperationException |
| 88 | * if removing elements from this {@code Map} is not supported. |
no outgoing calls
no test coverage detected