On Friday, November 9, 2012 1:40:48 PM UTC-8, Roedy Green wrote:
You might think
EnumSet.contains( subset ) would mean containsAnyOf or containsAllOf
Only if you don't read the Javadocs for '[Abstract]Collection#contains()", which make it
pretty obvious that 'contains()' applies to a single instance of the base type.
'EnumSet' is constrained to follow the semantics of the type it overrides with that method.
but it is meaningless.
It's meaning is clear from the Javadocs. Since an 'EnumSet' has as its base type the enum 'E',
then any call to 'contains(someSubsetNotABaseInstance)' must return 'false'.
There is an EnumSet.containsAll but no EnumSet.containsAnyOf
In this it is just like its parent type.
It seems odd Set and EnumSet don't directly support the usual things
mathematicians do with sets,
The operations would be so fast internally if Oracle used the binary
logic ops to handle bit strings, rather than flat-footed processing an
element at a time.
What think you?
Three out of four of the operations you wish were directly supported are.
The fourth takes two whole calls to support.