This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search based on Keys other than HashMap

 
Prashanti Potukuchi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I had a HashMap with some key and value pairs. Now the value part is no more valid. Can anybody suggest an alternative data structure so that i can still search based on the key, (instead of iterating through the entire thing like arrays) and do not have any associated value part.
Thanks
Prashanti
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, you just want to know if the key exists or not? No value to retrieve? Sounds like a HashSet.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, two more things:
1) Welcome to JavaRanch!
2) Please take another look at our display name policy and edit your display name to include a first and last name. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic