This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Hash MAP size Problem ?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello
the sql query is returning eighty(80) records in five columns where m_product_id cant be null , and fileds url1,url2,url3,url4 .....can be null or not.

.i am having 50 urls .

but in my hasp map , only 17 values are being inserted





i am printing the system outputs
there are total 50 urls






i wonder why all values are not inserting in hash map ? please suggest
?


With regards
Himanshu Walia
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himanshu Walia wrote:i am printing the system outputs
there are total 50 urls



Are all 50 unique ? Or there are only 17 unique values? (keys of the Map should be unique so when you add a key which was added earlier it will be replaced with the new one). (And I didn't count your output to see how many :wink).
 
Sheriff
Posts: 22579
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If url1 is null, and url2 is null, getURL.put(url2, ...) will overwrite the entry for url1, not add an extra entry. This is because Map's do not allow duplicate keys.
 
Himanshu Walia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay ! i got the problem
thanks folks
problem with duplicate values !
thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic