Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

defining enum with abstract method which returns a generic type

843793Sep 9 2008 — edited Sep 11 2008
Is it possible to define an abstract method which returns an geneic type like below? Thanks
public enum Type{
     A{
          public List<Integer> getData(){}
     },
     B{
          public Set<String> getData{}
     };

     abstract<T> T getData();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2008
Added on Sep 9 2008
6 comments
596 views