• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

problem with Map

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have a strange question. I am adding a Map object to another Map . But one of key , value pair is missing.

pageDataMap = buildPageDataMap(request);

Map formData = new HashMap();
formData.putAll( pageDataMap );

what could be the possible reason for this ?
I would like to thank you for your answer.

regards
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What data is missing? How do you know it's missing?
 
vv sreeram
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am using wsad .I was debugging it . In the earlier step a key with a multiple values was added which is missing after adding to the HashMap.

Thank You
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vv sreeram:
...what could be the possible reason for this?


Keys must be unique. Are you using the same key twice?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, what class are your keys? Does this class override equals() and hashCode()? Both these methods are used by a HashMap, and if there are any bugs in the implementation of these methods, they can cause strange behavior of the Map. If the class of your keys is one of the standard Java library classes (e.g. a String or Integer, to take two particularly common examples) then there's probably no problem, but if it's a class someone has created themselves, you might want to study the equals() and hashCode() methods to make sure they work correctly.
 
vv sreeram
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
The key is unique. The value is a String array. Thank you for your reply .


regards
 
That feels good. Thanks. Here's a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic