structure
Interface Map
- All Known Subinterfaces:
- OrderedMap
- All Known Implementing Classes:
- AbstractMap, ChainedHashtable, Hashtable, MapBST, MapList, Table
public interface Map
size
int size()
- Postcondition:
- returns the number of entries in the map
isEmpty
boolean isEmpty()
- Postcondition:
- returns true iff this map does not contain any entries
containsKey
boolean containsKey(java.lang.Object k)
- Precondition:
- k is non-null
- Postcondition:
- returns true iff k is in the domain of the map
containsValue
boolean containsValue(java.lang.Object v)
- Precondition:
- v is non-null
- Postcondition:
- returns true iff v is the target of at least one map entry;
that is, v is in the range of the map
get
java.lang.Object get(java.lang.Object k)
- Precondition:
- k is a key, possibly in the map
- Postcondition:
- returns the value mapped to from k, or null
put
java.lang.Object put(java.lang.Object k,
java.lang.Object v)
- Precondition:
- k and v are non-null
- Postcondition:
- inserts a mapping from k to v in the map
remove
java.lang.Object remove(java.lang.Object k)
- Precondition:
- k is non-null
- Postcondition:
- removes any mapping from k to a value, from the mapping
putAll
void putAll(Map other)
- Precondition:
- other is non-null
- Postcondition:
- all the mappings of other are installed in this map,
overriding any conflicting maps
clear
void clear()
- Postcondition:
- removes all map entries associated with this map
keySet
Set keySet()
- Postcondition:
- returns a set of all keys associated with this map
values
Structure values()
- Postcondition:
- returns a structure that contains the range of the map
entrySet
Set entrySet()
- Postcondition:
- returns a set of (key-value) pairs, generated from this map
equals
boolean equals(java.lang.Object other)
- Overrides:
equals
in class java.lang.Object
- Precondition:
- other is non-null
- Postcondition:
- returns true iff maps this and other are entry-wise equal
hashCode
int hashCode()
- Overrides:
hashCode
in class java.lang.Object
- Postcondition:
- returns a hash code associated with this structure