On 12/8/15 6:58 AM, Maurizio Cimadamore wrote:
I'm not too worried about the fact that typing 'EnumSet' is more verbose than just 'Set', obviously; but it would seem reasonable to try (within reasonable bounds) to provide uniform way to create collections and a smooth user experience. I think with the current status quo, we have that: Set.of(A, B, C) != EnumSet.of(A, B, C) and that's surprising, IMHO. At the same time I notice that, even with the overload I suggest, they would still be different beasts, as one would be mutable, while the other would not. That said, I think we should aim for an API where such bad surprises are avoided (why is my enumset so slow? Ah - it's not an enumset because I used the wrong XYZ.of method); unfortunately I don't have a good suggestion on how to get there :-( (which might mean that what you did is correct :-) )
Hm. OK, it's not obvious to me what should be done here, but there are enough things going on that I thought it was reasonable to open an RFE to cover this space. See
https://bugs.openjdk.java.net/browse/JDK-8145048 Feel free to add comments. s'marks