Skip to content

Commit

Permalink
Make JsonArrayImpl implement RandomAccess (#135)
Browse files Browse the repository at this point in the history
Co-authored-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
marschall and jbescos authored Nov 12, 2024
1 parent e9e85e5 commit 47b371b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.RandomAccess;

/**
* JsonArrayBuilder implementation
Expand Down Expand Up @@ -355,7 +356,7 @@ private void validateValue(Object value) {
}
}

private static final class JsonArrayImpl extends AbstractList<JsonValue> implements JsonArray {
private static final class JsonArrayImpl extends AbstractList<JsonValue> implements JsonArray, RandomAccess {
private final List<JsonValue> valueList; // Unmodifiable
private final JsonContext jsonContext;
private int hashCode;
Expand Down

0 comments on commit 47b371b

Please sign in to comment.