So i have a bunch of enum's that all extend an interface:
public interface MyInterface {}
I then have several enums that extend the interface:
public enum A implements MyInterface {}
public enum B implements MyInterface {}
I want a function that will accept only enum's that extend this interface. I cannot do:
public void MyFunction(MyInterface input)
because, inside the function, I create an EnumSet using EnumSet.of(input). I cannod do
public <T extends Enum<T>> void myFunction(T input)
because, inside the function, I need to create a Map that needs to be passed to another function. So is there any type-safe way to do this w/o casting?
Edit: Corrected interface definitions.