/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
*
*/
package com.sleepycat.collections;
import java.util.Map;
/**
* A simple Map.Entry
implementation that can be used as in
* input parameter. Since a MapEntryParameter
is not obtained
* from a map, it is not attached to any map in particular. To emphasize that
* changing this object does not change the map, the {@link #setValue} method
* always throws UnsupportedOperationException
.
*
*
Warning: Use of this interface violates the Java Collections
* interface contract since these state that Map.Entry
objects
* should only be obtained from Map.entrySet()
sets, while this
* class allows constructing them directly. However, it is useful for
* performing operations on an entry set such as add(), contains(), etc. For
* restrictions see {@link #getValue} and {@link #setValue}.
UnsupportedOperationException
since this
* object is not attached to a map.
*/
public V setValue(V newValue) {
throw new UnsupportedOperationException();
}
final void setValueInternal(V newValue) {
this.value = newValue;
}
/**
* Converts the entry to a string representation for debugging.
*
* @return the string representation.
*/
public String toString() {
return "[key [" + key + "] value [" + value + ']';
}
}