This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Java in General and the fly likes Using generics with enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using generics with enums" Watch "Using generics with enums" New topic

Using generics with enums

sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
Hi All,

I have a use case of an enum A, that has 4 values & these 4 values maps to 4 different emums , so that i can access the values of those enums


I can do A.Value_1.getMappedEnum().Value_1.1

or A.Value_2.getMappedEnum().Value_2.2

I feel this can be achieved by using generics + enums. I have not succeeded in doing so.
My source of truth is &

Could anyone please help me in achieving this.

I agree. Here's the link:
subject: Using generics with enums
It's not a secret anymore!