T
timasmith
per
http://java.sun.com/developer/technicalArticles/releases/j2se15langfeat/
there was an example of implementing enums prior to 5.0 (see below).
In 5.0 you have enum which is sweet for assigning arbitraty values but
I want to assign specific values and gain all of the other benefits of
using an enum...
so I want (can I have...?)
enum ASC {abc=3,ced=4};
and if you look at the cited pre 1.5 example you have that same
flexibility
public class MainMenu {
private final String name;
private MainMenu(String name) {
this.name = name;
}
public static final MainMenu FILE = new MainMenu("file");
public static final MainMenu EDIT = new MainMenu("edit");
public static final MainMenu FORMAT = new MainMenu("format");
public static final MainMenu VIEW = new MainMenu("view");
public String toString() {
return name;
}
}
http://java.sun.com/developer/technicalArticles/releases/j2se15langfeat/
there was an example of implementing enums prior to 5.0 (see below).
In 5.0 you have enum which is sweet for assigning arbitraty values but
I want to assign specific values and gain all of the other benefits of
using an enum...
so I want (can I have...?)
enum ASC {abc=3,ced=4};
and if you look at the cited pre 1.5 example you have that same
flexibility
public class MainMenu {
private final String name;
private MainMenu(String name) {
this.name = name;
}
public static final MainMenu FILE = new MainMenu("file");
public static final MainMenu EDIT = new MainMenu("edit");
public static final MainMenu FORMAT = new MainMenu("format");
public static final MainMenu VIEW = new MainMenu("view");
public String toString() {
return name;
}
}