954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

HashMap storing duplicate Keys

private Map<String , String> c = new HashMap<String , String>();
.... //regx to get mString
c.put(mString.group() , mString.group()); 
..... //regx to get mNumber
c.put(mNumber.group() , mNumber.group());
.......
Set set = c.entrySet();
		  Iterator i = set.iterator();
		  while( i.hasNext() ) {
			   Map.Entry me = (Map.Entry) i.next();
			   System.out.println(me.getKey() + " : " + me.getValue());
		  }

And for some reason when it has Bob as the key and Bob as the value, it decides to allow Bob to be a key again and a value again so I end up with 2 Bob key & values when i only want one. Any help is appreciated
Thanks in advance

white feather
Light Poster
49 posts since Apr 2010
Reputation Points: 18
Solved Threads: 2
 

Figured it out.

white feather
Light Poster
49 posts since Apr 2010
Reputation Points: 18
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: