Justification for using a bitfield instead of EnumSet in modern Java 8 API

前端 未结 2 1665
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 02:24

EnumSet, as old as the enum itself (both since Java 5), is supposed to be a noncompromizing replacement for the use case of bitfields: as fast and

2条回答
  •  误落风尘
    2020-12-14 02:59

    Should I reconsider the common best-practice advice to never use bitfields?

    Yes. You should generally reconsider any advice that contains the words "always" or "never", no matter if it is "common" or not so common.

提交回复
热议问题