Thursday, 6 October 2016

What is AbstractMap In Java ?

This blog is all about to learn Core Java Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.

Previously we have discussed about
What is TreeMap In Java ?
Here, we learn What is AbstractMap In Java.But before starting we must know what is Map Interface In Java.?
Class AbstractMap<K,V>

Type Parameters :-
K - the type of keys maintained by this map
V - the type of mapped values

All Implemented Interfaces :-

Direct Known Subclasses :-

Declaration of AbstractMap:
public abstract class AbstractMap<K,V>
extends Object
implements Map<K,V>

To implement an unmodifiable map, the programmer needs only to extend this class and provide an implementation for the entrySet method, which returns a set-view of the map's mappings.
This set should not support the add or remove methods, and its iterator should not support the remove method.
To implement a modifiable map, the programmer must additionally override this class's put method and the iterator returned by entrySet().iterator(); must additionally implement its remove method.

Nested Classes :-

Modifier and Type           Class and Description
static class                        AbstractMap.SimpleEntry<K,V> :- An Entry maintaining a key and a value.
static class                      AbstractMap.SimpleImmutableEntry<K,V> :- An Entry maintaining an                                                     immutable key and value.

Constructors :-

Modifier                           Constructor and Description
protected                           AbstractMap() :- Sole constructor.


No comments:

Post a Comment