• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enum Issue  RSS feed

 
Max Bean
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have


Is there any method to count the number of this enum and also loop to get each member of this enum?

Thnx
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remember correctly,

Test.values()

will give you an array of all Test instances, in the order they are declared.
 
Remko Strating
Ranch Hand
Posts: 893
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code solves your questions

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!