The map has three collection views, which are backed by the map (modifications on one show up on the other): a set of keys, a collection of values, and a set of key-value mappings. Some maps have a guaranteed order, but not all do.
Note: Be careful about using mutable keys. Behavior is unspecified if a key's comparison behavior is changed after the fact. As a corollary to this rule, don't use a Map as one of its own keys or values, as it makes hashCode and equals have undefined behavior.
All maps are recommended to provide a no argument constructor, which builds an empty map, and one that accepts a Map parameter and copies the mappings (usually by putAll), to create an equivalent map. Unfortunately, Java cannot enforce these suggestions.
The map may be unmodifiable, in which case unsupported operations will throw an UnsupportedOperationException. Note that some operations may be safe, such as putAll(m) where m is empty, even if the operation would normally fail with a non-empty argument. @author Original author unknown @author Eric Blake (ebb9@email.byu.edu) @see HashMap @see TreeMap @see Hashtable @see SortedMap @see Collection @see Set @since 1.2 @status updated to 1.4
|
|
|
|
|
|