How to get the key of a value in a hashmap in Java?

How can I get the key of a value in a hashmap?

The reason, I am asking this is because I need to remove items from a hashmap but I can only know the value at the time I want to remove the key, value pair.

If I can get the key then i can use this key to remove the key,value pair from the hashmap.

How can I get the key then?

Thanks,
TolgarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
If you're interested in keys and values, then you should probably be examining the entrySet()
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TolgarAuthor Commented:
Yes, I found it. Thanks. Actually, i fixed this problem. My code works but UI still hangs.

I cannot figure out why?
0
TolgarAuthor Commented:
@CEHJ: Can you please take a look at this related question:

http://www.experts-exchange.com/Programming/Languages/Java/Q_28262749.html#a39564220

Thanks,
0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

CEHJCommented:
You're using SWT are you not?
0
TolgarAuthor Commented:
Yes, I do.
0
CEHJCommented:
I can't help i'm afraid. I don't do SWT
0
TolgarAuthor Commented:
ok. No problem.

mccarl is helping me now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.