For the record, Iβm all for looking under the hood, but this design requires too much of any mortal encoder.
Immortals, of course, have infinite time at their disposal.
Enumeration.ValueSet supported by BitSet , but is not itself. Something in favor of composition.
[Have you heard of the heir to the whole fortune that haunted all this in his love of music? He preferred the composition by inheritance. Did I just do this or hear it in Java One?]
Undoubtedly, ValueSet should delegate more to BitSet methods, including isEmpty.
I was going to suggest trying values.iterator.isEmpty , but these are just hasNext tests that pass all checks of all possible values.
https://github.com/scala/scala/blob/v2.11.4/src/library/scala/collection/BitSetLike.scala#L109
If I read it correctly.
The best option is e.values.toBitMask forall (_ == 0) , which is the moral equivalent of BitSet.isEmpty .
source share