MAP interface description

xiaoxiao2021-03-06  54

The MAP interface does not inherit the Collection, as follows: Public Interface Map

Interface species definition 14 methods: 1.int size () 2.Boolean iSempty () 3.Boolean ContainSKey (Object value); 5.Object Get (Object Key) 6.object Put (Object) Key, Object Value 7.Object Remove (Object Key) 8.void Putall () 10.Set KeySet () 11.Collection Values ​​() 12.Set entryset () 13.Boolean Equals Object o) 14.Int hashcode ()

Description: GET (Object Key) Method: If there is no specified mapping, return null, but it is also possible that the value is NULL. PUT (Object Key, Object Value) Method: If Key does not exist, add a mapping to NULL. If Key already exists, replace the value value and return the original value (also possible null). REMOVE (Object Key) method: Returns NULL if key does not exist. If Key exists, delete the mapping, returns the deleted Value (also possible NULL). In addition, the interface defines an interface entry: Interface entry {Object getKey (); Object setValue (); boolean equals (Object O); int hashcode ();} This interface represents a key-value Mapping, we can regard a map as a set of Entry.

转载请注明原文地址:https://www.9cbs.com/read-115176.html

New Post(0)