Re: Generics and Enums
- From: Lew <lew@xxxxxxxxxxxxxxxx>
- Date: Sun, 29 Jul 2007 16:54:10 -0400
Roedy Green wrote:
On Sun, 29 Jul 2007 10:55:27 -0700, "amberarrow@xxxxxxxxx"
<amberarrow@xxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
I'm trying to write a generic class that takes an Enum as generic
parameter but
I'm not able to compile it:
------------------------------------
public class Foo<T extends Enum> {
Your class is similar to an EnumSet in terms of its Generics. So I
had a peek at how EnumSet does this
public abstract class EnumSet<E extends Enum<E>> extends
AbstractSet<E>
implements Cloneable, java.io.Serializable
This would allow the OP to eliminate the illegal "T.values()" expression and just call "values()".
--
Lew
.
- Follow-Ups:
- Re: Generics and Enums
- From: amberarrow@xxxxxxxxx
- Re: Generics and Enums
- References:
- Generics and Enums
- From: amberarrow@xxxxxxxxx
- Re: Generics and Enums
- From: Roedy Green
- Generics and Enums
- Prev by Date: Re: Generics and Enums
- Next by Date: Re: Generics and Enums
- Previous by thread: Re: Generics and Enums
- Next by thread: Re: Generics and Enums
- Index(es):
Relevant Pages
|