apache / accumulo

Apache Accumulo
https://accumulo.apache.org
Apache License 2.0
1.07k stars 445 forks source link

Use EnumSet for TStatus instead of Set #4929

Closed DomGarguilo closed 1 month ago

DomGarguilo commented 1 month ago

This PR changes the usages of Set<ReadOnlyFateStore.TStatus> to EnumSet<ReadOnlyFateStore.TStatus>. EnumSet is typically more efficient.

The only thing that is a bit different after this conversion is the public static final EnumSet<TStatus> ALL_STATUSES within the TStatus enum used to be unmodifiable since it was constructed via Collectors.toUnmodifiableSet(). I could not find a way to create an unmodifiable EnumSet, so ALL_STATUSES is technically modifiable now. ALL_STATUSES is just used for convenience so we don't have to write out the code to create a set of this Enum each time. Looking at the calling code I don't think it is an issue that it is modifiable now.