mirror of
https://github.com/google/brotli.git
synced 2024-11-21 19:20:09 +00:00
avoid array allocation in Encoder.Mode enum
This commit is contained in:
parent
36533a866e
commit
2ce0feba3c
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user