What is Map interface?

Answer Posted / guest

Java Collection Framework - Map Interface

The Map interface is not an extension of Collection
interface. Instead the interface starts of it?s own
interface hierarchy, for maintaining key-value associations.
The interface describes a mapping from keys to values,
without duplicate keys, by defination.
The Map interface follows.

public interface Map<K,V> {

// Basic operations
V put(K key, V value);
V get(Object key);
V remove(Object key);
boolean containsKey(Object key);
boolean containsValue(Object value);
int size();
boolean isEmpty();

// Bulk operations
void putAll(Map<? extends K, ? extends V> m);
void clear();

// Collection Views
public Set<K> keySet();
public Collection<V> values();
public Set<Map.Entry<K,V>> entrySet();

// Interface for entrySet elements
public interface Entry {
K getKey();
V getValue();
V setValue(V value);
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are this() and super() used with constructors in java programming?

794


Write a program to find the greatest of three numbers in java?

791


What is use of functional interface in java 8? Explain

788


Is 0 an irrational number?

835


Does java return by reference?

771


What two classes are used to read data only?

870


Why synchronization is important in java?

802


What is javac_g?

780


What is string and example?

798


what is the constructor and how many types of constructors are used in java?

769


What does exclamation mean in java?

783


What is a final class in java?

795


What is sizeof in java?

884


What is keyword and identifier?

899


Can we increase size of array?

784