diff options
Diffstat (limited to 'java/org/brotli/wrapper/enc/Encoder.java')
-rw-r--r-- | java/org/brotli/wrapper/enc/Encoder.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/java/org/brotli/wrapper/enc/Encoder.java b/java/org/brotli/wrapper/enc/Encoder.java index 696bd57..256713c 100644 --- a/java/org/brotli/wrapper/enc/Encoder.java +++ b/java/org/brotli/wrapper/enc/Encoder.java @@ -47,8 +47,11 @@ public class Encoder { */ 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]; } } |