Series: Map

Java Map interface classes like HashMap explained in simple terms

Map interface Methods Java

After knowing what Map is and its position in the collections hierarchy diagram, let us explore the methods. These methods can be used straight way by its derived data structures like TreeMap and HashMap. Following are the important Map interface Methods boolean containsKey(Object key1): Used to check the availability of a specific key, key1, in …

Map interface Methods Java Read More »

HashMap Example Java

Three programs are given on HashMap with different functionalities used very often in coding. HashMap General: In this program, API and the general operations like adding, retrieving and deleting elements, size and checking the existence of elements are done. HashMap Iteration: The iteration styles of elements, adding elements of one HashMap to another and cloning …

HashMap Example Java Read More »

HashMap Iteration Add Get Clone Java

Three programs are given on HashMap with different functionalities used very often in coding. HashMap General: In this program, API and the general operations like adding, retrieving and deleting elements, size and checking the existence of elements are done. HashMap Iteration: The iteration styles of elements, adding elements of one HashMap to another and cloning …

HashMap Iteration Add Get Clone Java Read More »

HashMap Sort Get Java

Three programs are given on HashMap with different functionalities used very often in coding. HashMap General: In this program, API and the general operations like adding, retrieving and deleting elements, size and checking the existence of elements are done. HashMap Iteration: The iteration styles of elements, adding elements of one HashMap to another and cloning …

HashMap Sort Get Java Read More »

TreeMap Tutorial Java

TreeMap is derived from SortedMap interface and attains the property of printing the elements in ascending order. With Comparator, the order can be changed. The Comparator should be supplied at the time of TreeMap object creation itself. Methods of TreeMap are not synchronized and thereby not thread-safe. Using in multithreaded environment is not advisable. A …

TreeMap Tutorial Java Read More »

TreeMap Example Java

Two programs are given on TreeMap with the following operations. TreeMap General: The general operations like object creation, addition and deletion of key/value pairs, knowing the existence of a key or value or elements and size etc. are performed. TreeMap Special: The special operations like sorting the elements on key basis and value basis, adding …

TreeMap Example Java Read More »

TreeMap add Sort Compare Java

Two programs are given on TreeMap with the following operations. TreeMap General: The general operations like object creation, addition and deletion of key/value pairs, knowing the existence of a key or value or elements and size etc. are performed. TreeMap Special: The special operations like sorting the elements on key basis and value basis, adding …

TreeMap add Sort Compare Java Read More »