Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

how do I iterate through enum values in Java

Solved 1 Answers 22 Views Programming
0 1
I have a scenario where I have to utilize hashmap values. Here key is Enum and value is of type String. Enum values keeps changing. I need to write loop so that I can iterate through each enum value and get appropriate value for the same.

1 Answer

Best answer

This is what you should be doing.


for (ENumClass eNumClass : ENumClass.values()){
     //your code here.
answered by (151 points)
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.