summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/java/util/AbstractMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/util/AbstractMap.java')
-rw-r--r--libjava/classpath/java/util/AbstractMap.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/libjava/classpath/java/util/AbstractMap.java b/libjava/classpath/java/util/AbstractMap.java
index 29249e1dc22..2f58121cede 100644
--- a/libjava/classpath/java/util/AbstractMap.java
+++ b/libjava/classpath/java/util/AbstractMap.java
@@ -69,10 +69,23 @@ import java.io.Serializable;
*/
public abstract class AbstractMap<K, V> implements Map<K, V>
{
- /** @since 1.6 */
+ /**
+ * A class containing an immutable key and value. The
+ * implementation of {@link Entry#setValue(V)} for this class
+ * simply throws an {@link UnsupportedOperationException},
+ * thus preventing changes being made. This is useful when
+ * a static thread-safe view of a map is required.
+ *
+ * @since 1.6
+ */
public static class SimpleImmutableEntry<K, V>
implements Entry<K, V>, Serializable
{
+ /**
+ * Compatible with JDK 1.6
+ */
+ private static final long serialVersionUID = 7138329143949025153L;
+
K key;
V value;
@@ -670,6 +683,12 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*/
public static class SimpleEntry<K, V> implements Entry<K, V>, Serializable
{
+
+ /**
+ * Compatible with JDK 1.6
+ */
+ private static final long serialVersionUID = -8499721149061103585L;
+
/**
* The key. Package visible for direct manipulation.
*/
@@ -730,7 +749,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*
* @return the key
*/
- public final K getKey()
+ public K getKey()
{
return key;
}
@@ -741,7 +760,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*
* @return the value
*/
- public final V getValue()
+ public V getValue()
{
return value;
}
@@ -755,7 +774,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*
* @return the hash code
*/
- public final int hashCode()
+ public int hashCode()
{
return (AbstractMap.hashCode(key) ^ AbstractMap.hashCode(value));
}
@@ -788,7 +807,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*
* @return the string representation
*/
- public final String toString()
+ public String toString()
{
return key + "=" + value;
}
OpenPOWER on IntegriCloud