![]() |
VOOZH | about |
The LinkedHashMap is just like HashMap with an additional feature of maintaining an order of elements inserted into it. HashMap provided the advantage of quick insertion, search, and deletion but it never maintained the track and order of insertion which the LinkedHashMap provides where the elements can be accessed in their insertion order.
To implement LinkedHashMap API first we create a class “ LinkedHashMapImplmentation” and create all the methods of the LinkedHashMap in this class.
Implementation of the LinkedHashMap API:
Size of the LinkedHashMap: 3 The key value pairs of LinkedHashMap: Anuj : 500 Ashok : 460 Aakansha : 495 LinkedHashMap contains Aakansha: true LinkedHashMap contains 450: false Size of the LinkedHashMap: 0