Skip to content

Commit

Permalink
reduce enum array allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
sullis committed Apr 23, 2024
1 parent cd3aafc commit b86089c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

//This class represents either the Json tokenizer and the Json parser.
public class JsonStreamParserImpl extends JohnzonJsonParserImpl implements JsonChars {
private static final Event[] EVENT_VALUES = Event.values();

private final boolean autoAdjust;

//the main buffer where the stream will be buffered
Expand Down Expand Up @@ -384,8 +386,8 @@ protected final char readNextNonWhitespaceChar(char c) {

@Override
public Event currentEvent() {
return previousEvent >= 0 && previousEvent < Event.values().length
? Event.values()[previousEvent]
return previousEvent >= 0 && previousEvent < EVENT_VALUES.length
? EVENT_VALUES[previousEvent]
: null;
}

Expand Down

0 comments on commit b86089c

Please sign in to comment.