The map will be empty after this call returns.ĬontainsKey public boolean containsKey( Object key) Removes all of the mappings from this map (optional operation). Returns a view of the values contained in this map. The specified behavior of underlying Object} methods wherever the The various Collections Framework interfaces are free to take advantage of Unequal hash codes cannot be equal.) More generally, implementations of Object#hashCode()} specification guarantees that two objects with Implement optimizations whereby the equals invocation is avoided,įor example, by first comparing the hash codes of the two keys. With a non-null argument key will cause key.equals(k) toīe invoked for any key k. Not be construed to imply that invoking Map.containsKey (key=null ? k=null : key.equals(k))." This specification should Only if this map contains a mapping for a key k such that ForĮxample, the specification for the #containsKey(Object)ĬontainsKey(Object key)} method says: "returns true if and In terms of the Object#equals(Object) equals} method. Many methods in Collections Framework interfaces are defined Such exceptions are marked as "optional" in the specification for this Throw an exception or it may succeed, at the option of the implementation. Would not result in the insertion of an ineligible element into the map may More generally,Īttempting an operation on an ineligible key or value whose completion The former behavior and some will exhibit the latter. Typically NullPointerException or ClassCastException.Īttempting to query the presence of an ineligible key or value may throw anĮxception, or it may simply return false some implementations will exhibit To insert an ineligible key or value throws an unchecked exception, Values, and some have restrictions on the types of their keys. For example, some implementations prohibit null keys and Some map implementations have restrictions on the keys and values they Method on an unmodifiable map may, but is not required to, throw theĮxception if the map whose mappings are to be "superimposed" is empty. To, throw an UnsupportedOperationException if the invocation would If this is the case, these methods may, but are not required UnsupportedOperationException if this map does not support the Methods that modify the map on which they operate, are specified to throw The "destructive" methods contained in this interface, that is, the There is no way toĮnforce this recommendation (as interfaces cannot contain constructors) butĪll of the general-purpose map implementations in the JDK comply. Producing an equivalent map of the desired class. In effect, the latter constructor allows the user to copy any map, Which creates a new map with the same key-value mappings as its argument. "standard" constructors: a void (no arguments) constructor which creates anĮmpty map, and a constructor with a single argument of type Map, Permissible for a map to contain itself as a value, extreme caution isĪdvised: the equals and hashCode methods are no longerĪll general-purpose map implementation classes should provide two Is not permissible for a map to contain itself as a key. A special case of this prohibition is that it The behavior of a map is not specified if the value of an object isĬhanged in a manner that affects equals comparisons while the Note: great care must be exercised if mutable objects are used as map Specific guarantees as to their order others, like the HashMap Some map implementations, like the TreeMap class, make The order in which the iterators on the map's collection views return theirĮlements. The Map interface provides three collection views, whichĪllow a map's contents to be viewed as a set of keys, collection of values, Was a totally abstract class rather than an interface. This interface takes the place of the Dictionary class, which Interface Map All Known Subinterfaces: Bindings, ConcurrentMap, MessageContext, SortedMap, LogicalMessageContext, SOAPMessageContext, NavigableMap, ConcurrentNavigableMap All Known Implementing Classes: AbstractMap, ConcurrentHashMap, ConcurrentSkipListMap, EnumMap, HashMap, IdentityHashMap, TreeMap, WeakHashMap, LinkedHashMap, PrinterStateReasons, Attributes, HashMap, Hashtable, Properties, UIDefaults, Provider, AuthProvider, IdentityHashMap, LinkedHashMap, RenderingHints, TabularDataSupport, WeakHashMapĪn object that maps keys to values. SUMMARY: NESTED | FIELD | CONSTR | METHOD Please send any questions or feedback to CLASS NEXT CLASS Placeholders for classes and methods, and auto-generated “See Also” links.Īdditionally it is missing some items found in standard Javadoc documentation, including: Jadeite adds extra features to the API including: This documentation differs from the official API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |