I am searching for a way to build a wrapper for multiple enums. Say you have
public enum Enum1 {
A,B,C
}
public enum Enum2 {
ONE,TWO,THREE
}
I want to have a new enum with the literals
(A,ONE), (A,TWO), (A,THREE), (B,ONE), ...
The whole thing generic so that I don’t have to know Enum1 and Enum2. Is there a way to build that or even extend it to n Enums?
Or should I look to other general ways to model that?
And here’s one that will wrap any number of enums. It comes as an Iterator but combine it with either or both of the other solutions and I think you’ve got all you asked for.
Prints:
Note that
Iterables.inmerely wraps anIterator<E>in anIterable<E>like this (not my code – I found it here on SO).