stop repetition

Ads
 

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 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() );
    }


  }
}

Ads









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
ModuleNotFoundError: No module named 'stop'
ModuleNotFoundError: No module named 'stop'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'stop' How to remove the ModuleNotFoundError: No module named 'stop' error
Advertisements
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
Version of jetty>stop dependency
List of Version of jetty>stop dependency
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
ModuleNotFoundError: No module named 'stop-words'
ModuleNotFoundError: No module named 'stop-words'  Hi, My Python... 'stop-words' How to remove the ModuleNotFoundError: No module named 'stop... have to install padas library. You can install stop-words python
Version of tomcat>stop-tomcat dependency
List of Version of tomcat>stop-tomcat dependency
Maven Dependency stop >> 4.2.27
You should include the dependency code given in this page to add Maven Dependency of jetty >> stop version4.2.27 in your project
Maven Dependency stop >> 5.0.alpha1
You should include the dependency code given in this page to add Maven Dependency of jetty >> stop version5.0.alpha1 in your project
Maven Dependency stop >> 5.1.10
You should include the dependency code given in this page to add Maven Dependency of jetty >> stop version5.1.10 in your project
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
ModuleNotFoundError: No module named 'many-stop-words'
ModuleNotFoundError: No module named 'many-stop-words'  Hi, My... named 'many-stop-words' How to remove the ModuleNotFoundError: No module named 'many-stop-words' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'celery-graceful-stop'
ModuleNotFoundError: No module named 'celery-graceful-stop'  Hi...: No module named 'celery-graceful-stop' How to remove the ModuleNotFoundError: No module named 'celery-graceful-stop' error? Thanks   Hi
ModuleNotFoundError: No module named 'biased-stop-words'
ModuleNotFoundError: No module named 'biased-stop-words'  Hi, My... named 'biased-stop-words' How to remove the ModuleNotFoundError: No module named 'biased-stop-words' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'patois-stop-words'
ModuleNotFoundError: No module named 'patois-stop-words'  Hi, My... named 'patois-stop-words' How to remove the ModuleNotFoundError: No module named 'patois-stop-words' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'virsh-start-stop'
ModuleNotFoundError: No module named 'virsh-start-stop'  Hi, My... named 'virsh-start-stop' How to remove the ModuleNotFoundError: No module named 'virsh-start-stop' error? Thanks   Hi, In your
Maven Dependency stop-tomcat >> 3.3.2
You should include the dependency code given in this page to add Maven Dependency of tomcat >> stop-tomcat version3.3.2 in your project
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 stop window closing in "internalFrameClosing" event.
How to stop window closing in "internalFrameClosing" event.  In an internal frame listener in the internalFrameClosing event I want to ask the user to confirm closure with a JDialog. The default close operation for the Internal
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
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
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

Ads