How do I find out, how many values my enum has in this example:
public class Analyser<C extends Enum<C>>{
private long[] dist;
public Analyser() {
super();
dist = new long [C.getEnumConstants().length];
}
}
The last line does not work.
You need to pass in the class literal of the enum:
This is because
Chas no meaning at runtime due to type erasure.