Home Answers Viewqa Java-Beginners stop repetition

 
 


chandrahas singh
stop repetition
1 Answer(s)      a year and 8 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.

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 Pages:
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
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
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
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
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 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
Assertions
Java NotesAssertions Assertions are used to stop execution when... way to stop many bugs before they go too far. Two forms of the assert statement...[] args) { // The following assert statement will stop execution
JavaScript clearTimeOut method
clearTimeOut() method is used to stop or clear the time out variables value...; <button onclick="intValue=window.clearTimeout(intValue);">Stop
java application - Applet
java application  codes in repetition and decision  codes in repition and decision
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
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
vasu86 - Java Beginners
vasu86  Hi! Please give me code to generate random numbers without repetition... between 1 to 100... thanks in advance
Loops
instructed for repetition of the code. PHP Loops In PHP, like other programming... of $ Counting; d. stop when $MyNumber reaches 11; The syntax for incrementing
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
J
J  how can stop back after logout
J
J  how can stop back after logout using javascript
ajax synchronisation
ajax synchronisation  how to stop ajax execution for some specific time
I have doubt in jsp file.
, there should be two buttons. One is start and other is stop. When we click on start then only stop should be enabled. Other wise it should be disabled. When we click on start button, stop should be enabled and start should be disabled
Playing mp3 file in Java...
Playing mp3 file in Java...  I created frame with play and stop buttons and added separate ActionListener to those buttons but i can't stop the music while playing
Loop
its endless. i would like to control the "start" stop" and step from an object. (made in blueJ) Class Loop public void loopUpGeneral(int start, int stop, int step){ for (int i = start; i = stop; step
INTEGERS
results. Use class Scanner and sentinel-controlled repetition to obtain the data
csp convert - Java Interview Questions
csp convert  Hi guys, Can anyone teach me How this CSP be converted into JCSP pls? REDPARCEL(size,id) = enterRed!size!id -> STOP BLUEPARCEL(size,id) = enterBlue!size!id -> STOP Thanks in advance, Sakai
jsp - JSP-Interview Questions
jsp  hi, we have a jsp page and when we send a request the jsp file will going to execute but the server is crashed, at that time we need to stop the execution of jsp file. how can we stop the jsp file
scrolling text in applet
border, it should stop moving and restart from the left. When the applet is deactivated, it should stop moving. It should restart moving from the previous location
Applet
Applet  Explain the start() and stop() methods of applet life cycle.... Stop () method: The stop() method can be called multiple times in the life.... There is only miner difference between the start() method and stop () method
for loop
which means to execute a part of code repeatedly. Repetition of a part of code can be done for a number of times or infinitely. If repetition of code is done for a number of times it is finite loop and if repetition is done infinitely
sorting - Java Beginners
. In the next repetition of the loop, find the largest value in A again and store the value
arrays help - Java Beginners
. In the next repetition of the loop, find the largest value in A again and store
java
java  dear sir write an application that prints the following diamond shape.you may use output statement that print a single aterisk(*), a signle space or a single new line character.Maximize your use of repetition
java
java  dear sir write an application that prints the following diamond shape.you may use output statement that print a single aterisk(*), a signle space or a single new line character.Maximize your use of repetition
algorithm
for initialize repetition = 1; for (i<= p) if b(i... or update v_o_p into temp; repeat same value for repetition time; end while repetition = repetition * v(i
instalation problem - Java Beginners
instalation problem  i try to install java ver 3-4-5 but. when progres going on that cant configuration. its stop when the indicator running in 1/4 progres.. thanx