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

What is a numeric literal?

530


What do you mean by Hash Map and Hash Table?

606


What is port number in java?

595


What is regex used for?

547


What are computer functions?

484






What is binary search in java?

559


What is the difference between static (class) method and instance method?

577


What is the major difference between linkedlist and arraylist?

513


Which browsers work with java?

564


Can you declare a private method as static?

700


How do you define a variable?

541


What is java util concurrentmodificationexception?

504


Will the compiler creates a default constructor if I have a parameterized constructor in the class?

587


How can we make copy of a java object?

547


How do you compare characters in java?

525