HashMap
hashMap.put("Matched", 1000L) ;
System.out.println("Map value" + hashMap.get("Unmatched")) ;
Output: null.
get
public V get(Object key)
- Returns the value to which the specified key is mapped, or
nullif this map contains no mapping for the key.More formally, if this map contains a mapping from a keykto a valuevsuch that(key==null ? k==null : key.equals(k)), then this method returnsv; otherwise it returnsnull. (There can be at most one such mapping.)
A return value ofnulldoes not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key tonull. ThecontainsKeyoperation may be used to distinguish these two cases.
-
- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
nullif this map contains no mapping for the key - See Also:
put(Object, Object)
No comments:
Post a Comment