Skip to main content

Posts

Showing posts with the label java hashmap example

java map example

Map Interface A Map stores data in key and value association. Both key and values are objects. The key must be unique but the values can be duplicate. Although Maps are a part of Collection Framework, they cannot actually be called as collections because of some properties that they posses. Interface Description Map Maps unique key to value. Map.Entry Describe an element in key and value pair in a map. Entry is sub interface of Map. NavigableMap Extends SortedMap to handle the retrienal of entries based on closest match searches SortedMap Extends Map so that key is maintained in an ascending order.   Commonly used Methods defined by Map ·          boolean  containsKey (Object  k ): returns true if map contain  k  as key. Otherwise false. ·          Object  get (Object  k ) : returns value...