public interface Map extends Rollbackable
Modifier and Type | Interface and Description |
---|---|
static interface |
Map.Entry
A map entry (key-value pair).
|
Modifier and Type | Method and Description |
---|---|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes
made at timestamp and afterward.
|
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object.
|
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable
object.
|
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object.
|
void |
clear()
Remove all entries from this Map (optional operation).
|
boolean |
containsKey(java.lang.Object key)
Returns true if this contains a mapping for the given key.
|
boolean |
containsValue(java.lang.Object value)
Returns true if this contains at least one mapping with the given value.
|
Set |
entrySet()
Returns a set view of the mappings in this Map.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this map for equality.
|
java.lang.Object |
get(java.lang.Object key)
Returns the value mapped by the given key.
|
int |
hashCode()
Returns the hash code for this map.
|
boolean |
isEmpty()
Returns true if the map contains no mappings.
|
Set |
keySet()
Returns a set view of the keys in this Map.
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the given key to the given value (optional operation).
|
void |
putAll(Map m)
Copies all entries of the given map to this one (optional operation).
|
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key if present (optional operation).
|
int |
size()
Returns the number of key-value mappings in the map.
|
Collection |
values()
Returns a collection (or bag) view of the values in this Map.
|
void clear()
java.lang.UnsupportedOperationException
- if clear is not supportedboolean containsKey(java.lang.Object key)
key
- the key to search forjava.lang.ClassCastException
- if the key is of an inappropriate typejava.lang.NullPointerException
- if key is null
but the map
does not permit null keysboolean containsValue(java.lang.Object value)
(value == null ? v == null : value.equals(v))
. This usually
requires linear time.value
- the value to search forjava.lang.ClassCastException
- if the type of the value is not a valid type
for this map.java.lang.NullPointerException
- if the value is null and the map doesn't
support null values.Set entrySet()
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition, via add
or addAll
, is
not supported via this set.Map.Entry
boolean equals(java.lang.Object o)
true
if the other object is a Map with the same mappings,
that is,o instanceof Map && entrySet().equals(((Map) o).entrySet();
This allows comparison of maps, regardless of implementation.equals
in class java.lang.Object
o
- the object to be comparedSet.equals(Object)
java.lang.Object get(java.lang.Object key)
null
if
there is no mapping. However, in Maps that accept null values, you
must rely on containsKey
to determine if a mapping exists.key
- the key to look upjava.lang.ClassCastException
- if the key is an inappropriate typejava.lang.NullPointerException
- if this map does not accept null keyscontainsKey(Object)
java.lang.Object put(java.lang.Object key, java.lang.Object value)
null
values, a null return does not
always imply that the mapping was created.key
- the key to mapvalue
- the value to be mappedjava.lang.UnsupportedOperationException
- if the operation is not supportedjava.lang.ClassCastException
- if the key or value is of the wrong typejava.lang.IllegalArgumentException
- if something about this key or value
prevents it from existing in this mapjava.lang.NullPointerException
- if either the key or the value is null,
and the map forbids null keys or valuescontainsKey(Object)
int hashCode()
hashCode
in class java.lang.Object
Map.Entry.hashCode()
boolean isEmpty()
Set keySet()
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition, via add
or addAll
, is
not supported via this set.void putAll(Map m)
m
- the mapping to load into this mapjava.lang.UnsupportedOperationException
- if the operation is not supportedjava.lang.ClassCastException
- if a key or value is of the wrong typejava.lang.IllegalArgumentException
- if something about a key or value
prevents it from existing in this mapjava.lang.NullPointerException
- if the map forbids null keys or values, or
if m
is null.put(Object, Object)
java.lang.Object remove(java.lang.Object key)
key
- the key to removejava.lang.UnsupportedOperationException
- if deletion is unsupportedjava.lang.NullPointerException
- if the key is null and this map doesn't
support null keys.java.lang.ClassCastException
- if the type of the key is not a valid type
for this map.int size()
Collection values()
Iterator.remove
,
Collection.remove
, removeAll
,
retainAll
, and clear
. Element addition, via
add
or addAll
, is not supported via this
collection.void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
timestamp
- The timestamp.void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Rollbackable
java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Rollbackable
checkpoint
- The new checkpoint object.Checkpoint.setCheckpoint(Checkpoint)