Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


neelam
Map interface
2 Answer(s)      3 years and 10 months ago
Posted in : Java Interview Questions


What is the Map interface?

Advertisement
View Answers

October 19, 2010 at 5:40 PM


Hi,

Here is the answer.

The java.util.Map interface represents a mapping between a key and a value. The Map interface is not a subtype of the Collection interface. Therefore it behaves a bit different from the rest of the collection types. 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 definition. The Map interface provides three collection views, which allow a map's contents to be viewed as a set of keys, collection of values, or set of key-value mappings. The order of a map is defined as the order in which the iterators on the map's collection views return their elements.

Thanks.



October 5, 2012 at 1:52 PM


The Map interface maps unique keys to values. A key is an object that you use to retrieve a value at a later date.

Given a key and a value, you can store the value in a Map object. After the value is stored, you can retrieve it by using its key.

Several methods throw a NoSuchElementException when no items exist in the invoking map.

A ClassCastException is thrown when an object is incompatible with the elements in a map.

A ClassCastException is thrown when an object is incompatible with the elements in a map.

A NullPointerException is thrown if an attempt is made to use a null object and null is not allowed in the map.

An UnsupportedOperationException is thrown when an attempt is made to change an unmodifiable map


Related Tutorials/Questions & Answers:
Map interface
Map interface  What is the Map interface
Introduction to Map and SortedMap Interface
Introduction to Map and SortedMap Interface       Map Interface: A Map... rather it has own interface hierarchy. Map provides a more general way
Advertisements
Map
Map  If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map either iterator or for each loop or for loop
map
map  using map, i want display message based on id selected [both are strings]   i do no   Hi Friend, Try the following code...) { Map map=new HashMap(); map.put("Message1","Hello
Collection Interface
Java NotesCollection Interface The Collection interface is the parent of the List and Set interfaces, but not Map. Assume the following declaration for identifiers in the table below: Collection coll; boolean b; Object obj; int i
Collection Interface
Java NotesCollection Interface The Collection interface is the parent of the List and Set interfaces, but not Map. Assume the following declaration for identifiers in the table below: Collection coll; boolean b; Object obj; int i
Java Map Iterate
Map is an Interface in the Collection Framework. Map is implemented by its two sub classes HashMap Treemap Map has no iterator method. So use the entrySet() method.It returns the data as Set Example of Java Map
Java Map iterator with example
Java Map Iterator is an interface. It keeps the data in the key and value form. It is implemented by HashMap, Tree Map. Map has no iterator method. So...() method to get the data in Set object form. Java Map Iterator with Example
Java Map Example
Map Interface adds keys to values. Every key in the Map Interface should be unique. It is part of java.util package. Each element in a map has a key... HashMap is used to implement Map Interface . put() method is used to add elements
interface
interface   what is the use of marking interface
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use... is achieved by using the interface (by implementing more than one interface at a time
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  why do we need interface in java..if it`s usefull for to obtain multiple inheritance in the sense how it gonna be achieved...and i can...)...the y we need interface...THis is question often i heard from my developer
Interface
for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract... implement(inherit)the interface and make use of the methods(functions
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
Map.Entry Java Interface
Map.Entry Java Interface Sometimes you need to work with map entry. This can be done using Map.Entry Interface of Java. The Map interface's entrySet( ) method returns a set of map . These sets are called as Map.Entry object
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  Declare an Interface called property containting a method compute price to compute &return the price.The inerface is to be implemented by follwaing two class (1)Bungalow&(2)Flat both the lasses have following
Hash Map
Hash Map  how to add the hash map objects in the list and iterate the objects
Interactive map
Interactive map  hi........ i require map to be zoom in and enlarge the area and show its detail. Can anyone tel me how can this be done using java swings .... plz help
Map code
Map code  hi................ I have map of navi mumbai, where i want to see the location vashi, nerul, turbhe.... means want to zoom into this area and then again zoom in and see nerul location more properly or other location
Map
hash map
hash map  write a program in hash map , that shows the value in asending order. but not key value. ex: key value ==== ===== k5 ashutosh k1 babita k7 debasis k2 vikas plz help me
Java Map Example
Java Map Example  How we can use Map in java collection?   The Map interface maps unique keys to value means it associate value to unique... Description:- The above example demonstrates you the Map interface. Since Map
hash map
=2; HashMap<Integer,Test> map=new HashMap<Integer,Test>
Java Map
is not an extension of the collection interface rather it has own interface hierarchy. Map... classes that implement the Map interface: TreeMap, HashMap, and LinkedHashMap... Java Map        
parse map in java
parse map in java  What is a Parser? Can you give the source code to parse map in Java
solution of k map in c
solution of k map in c  write a program in c to solve k-map with digital circuit
Map java Object to database.
Map java Object to database.  How do you map Java Objects with Database tables
Iterate Tag used with a Map.
Iterate Tag used with a Map.  How Iterate Tag used with a Map
about google map
about google map  how to add google map in website
about google map
about google map  how to add google map in website
add google map javascript
add google map javascript  How can i add google map using javascript in my web page?   Search for the " Google Maps Javascript API" it will allow you to embed the Google Map into your web Page
map on web page
map on web page   i want to insert an area map in my web page how can i do it ? please answer me soon. Its urgent
Stoting file name in Map
Stoting file name in Map  how to store id and file name in map
Google Map Integration - Ajax
Google Map Integration  Hi All, I am working on a vehicle tracking system project. I have to read data from sql server database and map the vehicle position in google map. I need to use ajax as the data is updated in every
JavaScript google map API example.
JavaScript google map API example.  How to Use Google Maps API in JavaScript?   Google Maps- A map is a way of representation of your route... routes, a road map shows you road, street information. In the same way google map
Store ResultSt Data in a Map
Store ResultSt Data in a Map  i want to store data in a hash Map .Please solve my problem as soon as possible
ApplicationDevelopment Using Google Map
ApplicationDevelopment Using Google Map  I want application using google map please guide me how can i develop
How to hold data in map
How to hold data in map  Holding data in map: i have user1 and he has account1,account2,accoutn3 like that user2,user3 will have accounts. now how to hold users and their accounts in hashmap
J2me Map load error
J2me Map load error  Hi , i am making a POC to load google map in my mobile,now i m getting the address of location by its lattitude and longitude in web page , but thing is i wana to store in my net beans emulator , its showing
Advertisements
 

 

 

DMCA.com