473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to place a map inside a list interface in Java?

can i place a map inside a list interface in java please help me with a example
Jan 18 '11 #1
3 2674
Dheeraj Joshi
1,123 Expert 1GB
Yes. Possible.

Expand|Select|Wrap|Line Numbers
  1. List l = new LinkedList();
  2.  
  3. HashMap mp = new HashMap();
  4. mp.put("1", "one");
  5. mp.put("2", "two");
  6. l.add(mp);
  7.  
  8. for (Object object : l) {
  9.     HashMap hp = (HashMap)object;
  10.         if(hp.get("1").equals("one")){
  11.                 System.out.println("True");
  12.     }
  13.     else{
  14.         System.out.println("False");
  15.     }
  16. }
  17.  
Regards
Dheeraj Joshi
Jan 18 '11 #2
thanku very much Dheeraj
Jan 18 '11 #3
for (Object object : l)
what is the meaning of this expression
Jan 18 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
2
by: TD | last post by:
I would like to set the value of the Y axes on my graph at runtime. I created the graph my opening a form and placing an unbound object frame on it then placed the MS Graph control into this. Next...
2
by: ws_dev2001 | last post by:
Hello all, I am trying to obtain the size of a java object in C by using JNI. As we do not have a proper implementation of this in java, I decided to see if C could provide me some accurate data....
1
by: Sai Kit Tong | last post by:
Hi, I am developing a new application running on Windows platform that needs to interface with existing legacy code - written in basic C / C++. I am trying to evaluate Java vs C#...
3
by: Sai Kit Tong | last post by:
Hi, I am developing a new application running on Windows platform that needs to interface with existing legacy code - written in basic C / C++. I am trying to evaluate Java vs C#...
0
by: Nathan | last post by:
Hello all, Thanks for all your help in the past. To start off, I'm much more familiar with the web aspect of this stuff. So a DropDownList in the middle of a DataSet or Repeater is no big...
6
by: gauravkhanna | last post by:
import java.io.*; class Automation1 implements Runnable { int iterationCount=0; Thread t; FileReader fr; //FileWriter fw; BufferedReader br; ...
1
by: luthriaajay | last post by:
Has anyone used the 'importNode' and the 'replaceChild' methods of Interface Document and Node or adding 2 XML documents ? I need to add 2 XML documents in Java. DocumentOne -----------...
1
by: beginner | last post by:
Hi All, I am wondering if there is any way to handle exceptions inside list comprehension. For example, I want to skip the point if f(x) raises an exception. How can I do that without...
1
by: Robertsonjay | last post by:
In mvc you separate view from controller. How do you do that in C#? Many people define an interface for a controller but isn't controller is specific to a form(gui) which all controller contains...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.