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



Home Answers Viewqa Java-Beginners stop repetition
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


chandrahas singh
stop repetition
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


i want to know use of Hashmap, and its contains key value option. the problem is , i am accessing records through a loop but I want to access only those records that has unique id. I dont want to use sameid record more than one time. so could u please guide me how to handle this problem.

through this id i m creating a shape node so multiple nodes are build even they have same id so i want to stop repetition.


Advertisement
View Answers

October 11, 2011 at 2:11 PM


import java.util.*;

public class HashMapExample{

  public static void main(String[] args) {

    HashMap hm = new HashMap();
    hm.put(1,"A");
    hm.put(2,"B");
    hm.put(1,"C");
    hm.put(3,"D");
    hm.put(4,"E");

    Set set = hm.entrySet();

    Iterator i = set.iterator();

    while(i.hasNext()){
      Map.Entry me = (Map.Entry)i.next();
      System.out.println(me.getKey() + " : " + me.getValue() );
    }


  }
}


Related Tutorials/Questions & Answers:
stop repetition
they have same id so i want to stop repetition...stop repetition  i want to know use of Hashmap, and its contains key value option. the problem is , i am accessing records through a loop but I want
how to stop audio (mp3)
how to stop audio (mp3)   if(e.getActionCommand(). equals("Stop... have to stop a song. on writing player.close() it pauses the song rather than stopping it. how should i stop the song keeping in mind i have to play another song
Advertisements
stop the running hidden server
stop the running hidden server  Port 8080 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another... will need to stop the other process or change the port number(s). how to stop tis
Generate array of random numbers without repetition
Generate array of random numbers without repetition In the previous section, you have learnt how to generate an array of random numbers from the given array... repetition. Here we have allowed the user to enter the elements of array
Java how to stop audio
Java how to stop audio  hello i have this code in the main: try { AudioInputStream audio = AudioSystem.getAudioInputStream(new File...); } I want that when i press the stop button in the gui, the audio stops
How to stop the execution of midlet in j2me?
How to stop the execution of midlet in j2me?  Hi, How to stop the execution of midlet of j2me for a specific amount of time? Thanks & Regards, Sivakumar.J
stop an infinite for loop - Java Beginners
stop an infinite for loop  class InfiniteForLoop{ public static void main(String[] args) { for(;;){ } } } i want this infinite for loop program to be stopped by another program named kill
Java Thread : stop() method
Java Thread : stop() method In this section we are going to describe stop() method with example in java thread. stop() method : Java thread provides method stop to stop any running thread. It is deprecated  as it causes
stop word removal from text file
stop word removal from text file  i need java source code for stop word removal from a text file
how to solve 'Stop Running This Script' Error ?
how to solve 'Stop Running This Script' Error ?  Hi.. When opened the page on IE browser(version : 8.0),it gives an java script error (i.e.Stop Running This Script). I have used jsp/servlet for this. Please help to resolved
how to allow or stop using internet - Java Server Faces Questions
how to allow or stop using internet  hello this is my first qusetion I am developing a cybercafe management tool in java,the problem is how to allow or stop the users of cafe using internet by the administrator on other
Need simple java code to start and stop the remote windows service.
Need simple java code to start and stop the remote windows service.  Hi, I Need simple java code to start and stop the remote windows service. Example:There are two servers 1) Server A and 2) Server B. If a notepad.exe file
iPhone play, pause and stop playing music
iPhone play, pause and stop playing music This is the small iPhone SDK example that will show you how to play, pause and stop the music on button...; -(IBAction) stop:(id)sender; -(IBAction) pause:(id)sender; @end
How to stop java scripting engine when the script being run is taking too much time?
How to stop java scripting engine when the script being run is taking too much time?   How to stop java scripting engine when the script being run is taking too much time? for e,g, in case of infinite loop the memory is getting
Code to STOP Students from navigating anywhere else till the Online exam is over
Code to STOP Students from navigating anywhere else till the Online exam is over  hi guys i am a final year student of engineering and i am working on an ONLINE EXAMINATION SYSTEM just like GATE, GRE usually used by prometrics
Repeat word as many times as it has characters
Repeat word as many times as it has characters in Java This section illustrates you the repetition of same word as many times as it has characters in it. To do this, we prompt the user to enter the word using the Scanner class. After
Iteration
Iteration The concept of Iteration has made our life much more easier. Repetition of similar tasks is what Iteration is and that too without making any... repetition. Now lets have a quick look at the iteration statements which have
JavaScript clearTimeOut method
clearTimeOut() method is used to stop or clear the time out variables value...; <button onclick="intValue=window.clearTimeout(intValue);">Stop
J2ME Command Class
commands namely, screen, back, cancel, ok, help, stop, ...;Command screen, back, cancel, ok, help, stop, ...;stop = new Command("Stop", Command.STOP, 6);  
Car Rentals in Delhi
Car/ Coach Rentals in Delhi Want to visit the city of Delhi in a private car so that you can stop and go at your will? You must be looking for a car rental in Delhi. There are a host of car rentals in Delhi that can offer you best
How to Recover from Penguin 2.0 Update Penalty?
this is to stop doing spamming. Here are few things that a SEO needs to work...: At first stop targeting the search engine, instead target the audience... heavily punished. So, mix up your anchor text. Stop paid linking and start guest
Delhi to Agra Tour by Car
to stop and drive at will and have a glance over places of tourist interest
How to Recover from Google Penguin Update and Get the Ranking Back
websites. Immediately Stop Paid Links: These are the much talked about change
A Brief Introduction to Travel
destinations with short stop over's on the way to the final destination to be reached
Kerala Travel Guide
one-stop information source to know more about this scenic landscape, its
PHP FORM Part-7
the time anyone tell it to stop.  We also need to mention two other things... or decrement the value and if it couldn't update the starting value, it will stop
Threads in Java
Threads in Java help in multitasking. They can stop or suspend a specific running process and start or resume the suspended processes. This helps in increasing the speed of the processes. In Java programming, Java Virtual Machine (JVM
java application - Applet
java application  codes in repetition and decision  codes in repition and decision
vasu86 - Java Beginners
vasu86  Hi! Please give me code to generate random numbers without repetition... between 1 to 100... thanks in advance
Iteration
Iteration  hii, What is an iteration?   hello, The act or an instance of iterating; repetition. time-boxed sequence of activities that results in a release of an executable product
 

 

 

DMCA.com