A key-value mapping. @param the type of key @param the type of value @since 1.6
| 162 | * @since 1.6 |
| 163 | */ |
| 164 | public static class SimpleEntry<K, V> implements Map.Entry<K, V> { |
| 165 | |
| 166 | private static final long serialVersionUID = -8499721149061103585L; |
| 167 | |
| 168 | private K key; |
| 169 | |
| 170 | private V value; |
| 171 | |
| 172 | /** |
| 173 | * Constructs a new instance by key and value. |
| 174 | * |
| 175 | * @param theKey |
| 176 | * the key |
| 177 | * @param theValue |
| 178 | * the value |
| 179 | */ |
| 180 | public SimpleEntry(K theKey, V theValue) { |
| 181 | key = theKey; |
| 182 | value = theValue; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Constructs a new instance by an entry |
| 187 | * |
| 188 | * @param entry |
| 189 | * the entry |
| 190 | */ |
| 191 | public SimpleEntry(Map.Entry<? extends K, ? extends V> entry) { |
| 192 | key = entry.getKey(); |
| 193 | value = entry.getValue(); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * {@inheritDoc} |
| 198 | * |
| 199 | * @see java.util.Map.Entry#getKey() |
| 200 | */ |
| 201 | public K getKey() { |
| 202 | return key; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * {@inheritDoc} |
| 207 | * |
| 208 | * @see java.util.Map.Entry#getValue() |
| 209 | */ |
| 210 | public V getValue() { |
| 211 | return value; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * {@inheritDoc} |
| 216 | * |
| 217 | * @see java.util.Map.Entry#setValue(java.lang.Object) |
| 218 | */ |
| 219 | public V setValue(V object) { |
| 220 | V result = value; |
| 221 | value = object; |
nothing calls this directly
no outgoing calls
no test coverage detected