How to iterate map in collection framework?



How to iterate map in collection framework?..

Answer / navin kumar

Map<String,String> map = new HashMap<String,String>();
map.put("A","Rohan");
map.put("C","Sohan");
map.put("B","Ram");

for(String key : map.entrySet()){
sop(key);//A,C and B as key
sop(map.get(key))//Rohan,Sohan and Ram as values
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Software Interview Questions

What is planning? How is it used, and what are its advantages? Is it feasible to use planning in real-time games? If so, name any titles where planning has been used for any part of the AI. Describe the architecture of a planning-based AI system for any genre of game.

0 Answers  


What would be the possible test cases for following criteria You have a username filed which don't accept same name twice

0 Answers  


In one room in your game, there's an elevator that AIs will need to use to escape from the player. In order to use the elevator, they have to walk over to a special button on the wall, press it to summon the elevator, then walk into the elevator and press another button to tell it to ascend. How would you design a system to make sure AIs can do all of these things in the proper order? If you have 3 AIs in the room, how would you design the system to make sure they can all escape in the elevator at the same time? What happens if one of them dies while they're trying to do this, and how do you make sure the other AIs don't get stuck waiting for that dead AI?

0 Answers   TCS,


What are Aggregate Functions?

0 Answers  


What are attractors and repulsors? How do they interact with a steering system? When are they useful, and what are their limitations? When can they be used for obstacle avoidance, and when are they insufficient?

0 Answers  






How Accounting determination happened?

0 Answers  


what is FORMAT keyword

0 Answers  


where will movement type get assigned?

0 Answers  


How to Access a Database?

0 Answers  


How can you determine if a ray intersects a sphere? The more efficient your solution, the better.

0 Answers  


You're working on a game that involves enemy wizards dueling each other. Each wizard has at least a dozen different spells at his disposal -- some of them simply inflict damage, while others will temporarily stun or immobilize an enemy, slow him, prevent him from casting spells for a brief duration, teleport the caster a short distance, or give the caster a temporary shield. A wizard can only cast one spell at a time, but each spell has a fixed cooldown (time before it can be cast again) and an associated mana cost (assume no mana regeneration). Describe some ways you might implement a competent AI system for a wizard.

0 Answers  


You're tasked with implementing a computer player for a real-time strategy (RTS) game. Assuming that there is no fog-of-war, how do you implement a system to allow the computer player to determine what parts of the map are controlled by enemy players, and which parts are open to easy exploitation? How do you identify the choke points on the map? How do you find the boundary between the parts of the map under your control and the parts of the map controlled by enemy players? How do you detect an impending enemy attack or a change in an enemy's offensive posture?

0 Answers  


Categories