enfrptes

sendassignment@tutorspoint.com

Map Classes Homework Help

What are Map classes in Java?

a) Several classes provide implementations of the map interfaces. The classes that can be used for the maps are shown below.

b) Abstract map, hashmap, treemap, weak hash map, linked hash map, identify hash map.

c) The map class hierarchy is,

                                                                      Map (interface)

                                                                        Abstract Map

Hashmap    Treemap                 weak hashmap             identify hashmap           Linked Hashmap

 

The hashmap class:

a) The hash map class uses a hash table to implement the map interface.

b) This allows the execution time of basic operations, such as get () and put (), to remain constant even for large sets.

The treemap classes:

a) The treemap class implements the map interface by using a tree.

b) A treemap provides an efficient means of storing key/value pairs in the sorted order and allows rapid retrieval.

c) A treemap guarantees that its elements will be sorted in ascending key order.

The linked hashmap classes:

a) This class extends maps.

b) Linked hash map maintains a linked list of the entries in the map, in the order in which they were inserted. Thus, when iterating a linked hash map, the elements will be returned in the order in which they were inserted.

c) We can also create a linked hash map that returns its elements in the order in which they were last accessed.

The identity hash map class:

a) This class extends the hash abstract map.

b) It is similar to the hash map except that it uses reference equality when comparing elements.

c) The java2 documentation explicitly states that identifying a hash map is not for general use.