Computer Science, asked by anutwins2626, 8 months ago


You want to create an instance of a new map such that its iteration order is the same as the iteration order of an existing instance of a map. Which concrete implementation of the map interface will you use for the new instance?
Select
TreeMap
HashMap
LinkedHashMap
Depends on the implementation of the existing instance

Answers

Answered by aditijaink283
0

Answer:

The answer to the given question is:

LinkedHashMap

Explanation:

The LinkedHashMap class is similar to a HashMap with the added feature of maintaining the order of inserted elements. HashMap provided the benefits of fast inserts, searches, and deletes, but did not support the tracking and insert ordering that LinkedHashMap provides. Here, elements can be accessed in insertion order. So the class is declared like this:

  • public class LinkedHashMap
  • extends HashMap
  • Implementation Map

This class stores data as nodes. LinkedHashMap implementation is very similar to doubly linked list. LinkedHashMap implementation is out of sync. If multiple threads concurrently access the associated hash map, and one or more of the threads structurally modify the map, they must be externally synchronized.

#SPJ2

Similar questions
Science, 8 months ago