Relates :
|
EnumSet and EnumMap each have a private static final Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0]; In EnumMap it's unused, but in EnumSet it's used for serialization purposes: SerializationProxy(EnumSet<E> set) { elementType = set.elementType; elements = set.toArray(ZERO_LENGTH_ENUM_ARRAY); } Having these constants is hardly justified[1] and incurs an ever so slight startup/footprint cost by loading Enum[].class [1] http://shipilev.net/blog/2016/arrays-wisdom-ancients/#_caching_the_array