Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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
 
We don't have time for this. We've gotta save the moon! Or check this out:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!