Skip to content

Commit

Permalink
Merge pull request #1005 from sullis:enum-values
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 506138469
  • Loading branch information
eustas committed Feb 1, 2023
2 parents 38e9add + 2ce0feb commit ed1995b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion java/org/brotli/wrapper/enc/Encoder.java
Expand Up @@ -47,8 +47,11 @@ public enum Mode {
*/
FONT;

// see: https://www.gamlor.info/wordpress/2017/08/javas-enum-values-hidden-allocations/
private static final Mode[] ALL_VALUES = values();

public static Mode of(int value) {
return values()[value];
return ALL_VALUES[value];
}
}

Expand Down

0 comments on commit ed1995b

Please sign in to comment.