E
Eric Smith
I'd like to create a subclass of EnumSet to implement the Comparable
interface (using my own arbitrary ordering, so that I can use the
subclass as a key in a dictionary), but I can't seem to figure
out how to do it.
I tried:
import java.util.EnumSet;
public abstract class Foo<E extends Enum<E>> extends EnumSet<E>
implements Comparable<Foo>
{
public int compareTo (Foo o)
{
return 1; // dummy value for now
}
}
The compiler says:
Foo.java:3: cannot find symbol
symbol : constructor EnumSet()
location: class java.util.EnumSet<E>
public abstract class Foo<E extends Enum<E>> extends EnumSet<E>
^
1 error
I don't understand why it thinks there should be an EnumSet()
constructor, since I'm subclassing it as an abstract class.
Any hints or suggestions?
Thanks!
Eric
interface (using my own arbitrary ordering, so that I can use the
subclass as a key in a dictionary), but I can't seem to figure
out how to do it.
I tried:
import java.util.EnumSet;
public abstract class Foo<E extends Enum<E>> extends EnumSet<E>
implements Comparable<Foo>
{
public int compareTo (Foo o)
{
return 1; // dummy value for now
}
}
The compiler says:
Foo.java:3: cannot find symbol
symbol : constructor EnumSet()
location: class java.util.EnumSet<E>
public abstract class Foo<E extends Enum<E>> extends EnumSet<E>
^
1 error
I don't understand why it thinks there should be an EnumSet()
constructor, since I'm subclassing it as an abstract class.
Any hints or suggestions?
Thanks!
Eric