blob: ebe108e05b31cf4803b9d7df9fedc31df43de501 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>JsonArray (JSON Processing API documentation)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JsonArray (JSON Processing API documentation)";
}
}
catch(err) {
}
//-->
var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":18,"i12":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JsonArray.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><br>JSON Processing API v2.0.0</div>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="moduleLabelInType">Module</span>&nbsp;<a href="../../module-summary.html">jakarta.json</a></div>
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">jakarta.json</a></div>
<h2 title="Interface JsonArray" class="title">Interface JsonArray</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a>&lt;<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;</code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Iterable</a>&lt;<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;</code>, <code><a href="JsonStructure.html" title="interface in jakarta.json">JsonStructure</a></code>, <code><a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;</code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">JsonArray</span>
extends <a href="JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;</pre>
<div class="block"><code>JsonArray</code> represents an immutable JSON array
(an ordered sequence of zero or more values).
It also provides an unmodifiable list view of the values in the array.
<p>A <code>JsonArray</code> object can be created by reading JSON data from
an input source or it can be built from scratch using an array builder
object.
<p>The following example demonstrates how to create a <code>JsonArray</code>
object from an input source using the method <a href="JsonReader.html#readArray()"><code>JsonReader.readArray()</code></a>:
<pre><code>
JsonReader jsonReader = Json.createReader(...);
JsonArray array = jsonReader.readArray();
jsonReader.close();
</code></pre>
<p>The following example demonstrates how to build an empty JSON array
using the class <a href="JsonArrayBuilder.html" title="interface in jakarta.json"><code>JsonArrayBuilder</code></a>:
<pre><code>
JsonArray array = Json.createArrayBuilder().build();
</code></pre>
<p>The example code below demonstrates how to create the following JSON array:
<pre><code>
[
{ "type": "home", "number": "212 555-1234" },
{ "type": "fax", "number": "646 555-4567" }
]
</code></pre>
<pre><code>
JsonArray value = Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("type", "home")
.add("number", "212 555-1234"))
.add(Json.createObjectBuilder()
.add("type", "fax")
.add("number", "646 555-4567"))
.build();
</code></pre>
<p>The following example demonstrates how to write a <code>JsonArray</code> object
as JSON data:
<pre><code>
JsonArray arr = ...;
JsonWriter writer = Json.createWriter(...)
writer.writeArray(arr);
writer.close();
</code></pre>
<p>The values in a <code>JsonArray</code> can be of the following types:
<a href="JsonObject.html" title="interface in jakarta.json"><code>JsonObject</code></a>, <a href="JsonArray.html" title="interface in jakarta.json"><code>JsonArray</code></a>,
<a href="JsonString.html" title="interface in jakarta.json"><code>JsonString</code></a>, <a href="JsonNumber.html" title="interface in jakarta.json"><code>JsonNumber</code></a>, <a href="JsonValue.html#TRUE"><code>JsonValue.TRUE</code></a>,
<a href="JsonValue.html#FALSE"><code>JsonValue.FALSE</code></a>, and <a href="JsonValue.html#NULL"><code>JsonValue.NULL</code></a>.
<code>JsonArray</code> provides various accessor methods to access the values
in an array.
<p>The following example shows how to obtain the home phone number
"212 555-1234" from the array built in the previous example:
<pre><code>
JsonObject home = array.getJsonObject(0);
String number = home.getString("number");
</code></pre>
<p><code>JsonArray</code> instances are list objects that provide read-only
access to the values in the JSON array. Any attempt to modify the list,
whether directly or using its collection views, results in an
<code>UnsupportedOperationException</code>.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="nested.classes.inherited.from.class.jakarta.json.JsonValue">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface&nbsp;jakarta.json.<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a></h3>
<code><a href="JsonValue.ValueType.html" title="enum in jakarta.json">JsonValue.ValueType</a></code></li>
</ul>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.jakarta.json.JsonValue">
<!-- -->
</a>
<h3>Fields inherited from interface&nbsp;jakarta.json.<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a></h3>
<code><a href="JsonValue.html#EMPTY_JSON_ARRAY">EMPTY_JSON_ARRAY</a>, <a href="JsonValue.html#EMPTY_JSON_OBJECT">EMPTY_JSON_OBJECT</a>, <a href="JsonValue.html#FALSE">FALSE</a>, <a href="JsonValue.html#NULL">NULL</a>, <a href="JsonValue.html#TRUE">TRUE</a></code></li>
</ul>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getBoolean(int)">getBoolean</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns the boolean value at the specified position.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getBoolean(int,boolean)">getBoolean</a></span>&#8203;(int&nbsp;index,
boolean&nbsp;defaultValue)</code></th>
<td class="colLast">
<div class="block">Returns the boolean value at the specified position.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInt(int)">getInt</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">A convenience method for
<code>getJsonNumber(index).intValue()</code>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInt(int,int)">getInt</a></span>&#8203;(int&nbsp;index,
int&nbsp;defaultValue)</code></th>
<td class="colLast">
<div class="block">Returns the int value of the <code>JsonNumber</code> at the specified position.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="JsonArray.html" title="interface in jakarta.json">JsonArray</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJsonArray(int)">getJsonArray</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns the array value at the specified position in this array.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="JsonNumber.html" title="interface in jakarta.json">JsonNumber</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJsonNumber(int)">getJsonNumber</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns the number value at the specified position in this array.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="JsonObject.html" title="interface in jakarta.json">JsonObject</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJsonObject(int)">getJsonObject</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns the object value at the specified position in this array.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="JsonString.html" title="interface in jakarta.json">JsonString</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getJsonString(int)">getJsonString</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns the string value at ths specified position in this array.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getString(int)">getString</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">A convenience method for
<code>getJsonString(index).getString()</code>.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getString(int,java.lang.String)">getString</a></span>&#8203;(int&nbsp;index,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;defaultValue)</code></th>
<td class="colLast">
<div class="block">Returns the <code>String</code> value of <code>JsonString</code> at the specified
position in this JSON array values.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>&lt;T extends <a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;<br><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;T&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getValuesAs(java.lang.Class)">getValuesAs</a></span>&#8203;(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;T&gt;&nbsp;clazz)</code></th>
<td class="colLast">
<div class="block">Returns a list view of the specified type for the array.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>default &lt;T,&#8203;K extends <a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;<br><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;T&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getValuesAs(java.util.function.Function)">getValuesAs</a></span>&#8203;(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Function</a>&lt;K,&#8203;T&gt;&nbsp;func)</code></th>
<td class="colLast">
<div class="block">Returns a list view for the array.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isNull(int)">isNull</a></span>&#8203;(int&nbsp;index)</code></th>
<td class="colLast">
<div class="block">Returns <code>true</code> if the value at the specified location in this
array is <code>JsonValue.NULL</code>.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.util.Collection">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.util.<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true#parallelStream()" title="class or interface in java.util" class="externalLink">parallelStream</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true#removeIf(java.util.function.Predicate)" title="class or interface in java.util" class="externalLink">removeIf</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true#stream()" title="class or interface in java.util" class="externalLink">stream</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html?is-external=true#toArray(java.util.function.IntFunction)" title="class or interface in java.util" class="externalLink">toArray</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Iterable">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Iterable</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html?is-external=true#forEach(java.util.function.Consumer)" title="class or interface in java.lang" class="externalLink">forEach</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.jakarta.json.JsonStructure">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;jakarta.json.<a href="JsonStructure.html" title="interface in jakarta.json">JsonStructure</a></h3>
<code><a href="JsonStructure.html#getValue(java.lang.String)">getValue</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.jakarta.json.JsonValue">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;jakarta.json.<a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a></h3>
<code><a href="JsonValue.html#asJsonArray()">asJsonArray</a>, <a href="JsonValue.html#asJsonObject()">asJsonObject</a>, <a href="JsonValue.html#getValueType()">getValueType</a>, <a href="JsonValue.html#toString()">toString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.util.List">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.util.<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#add(int,E)" title="class or interface in java.util" class="externalLink">add</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#add(E)" title="class or interface in java.util" class="externalLink">add</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#addAll(int,java.util.Collection)" title="class or interface in java.util" class="externalLink">addAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#addAll(java.util.Collection)" title="class or interface in java.util" class="externalLink">addAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#clear()" title="class or interface in java.util" class="externalLink">clear</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#contains(java.lang.Object)" title="class or interface in java.util" class="externalLink">contains</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#containsAll(java.util.Collection)" title="class or interface in java.util" class="externalLink">containsAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util" class="externalLink">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#get(int)" title="class or interface in java.util" class="externalLink">get</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#hashCode()" title="class or interface in java.util" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#indexOf(java.lang.Object)" title="class or interface in java.util" class="externalLink">indexOf</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#isEmpty()" title="class or interface in java.util" class="externalLink">isEmpty</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#iterator()" title="class or interface in java.util" class="externalLink">iterator</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#lastIndexOf(java.lang.Object)" title="class or interface in java.util" class="externalLink">lastIndexOf</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#listIterator()" title="class or interface in java.util" class="externalLink">listIterator</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#listIterator(int)" title="class or interface in java.util" class="externalLink">listIterator</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#remove(int)" title="class or interface in java.util" class="externalLink">remove</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#remove(java.lang.Object)" title="class or interface in java.util" class="externalLink">remove</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#removeAll(java.util.Collection)" title="class or interface in java.util" class="externalLink">removeAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#replaceAll(java.util.function.UnaryOperator)" title="class or interface in java.util" class="externalLink">replaceAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#retainAll(java.util.Collection)" title="class or interface in java.util" class="externalLink">retainAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#set(int,E)" title="class or interface in java.util" class="externalLink">set</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#size()" title="class or interface in java.util" class="externalLink">size</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#sort(java.util.Comparator)" title="class or interface in java.util" class="externalLink">sort</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#spliterator()" title="class or interface in java.util" class="externalLink">spliterator</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#subList(int,int)" title="class or interface in java.util" class="externalLink">subList</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#toArray()" title="class or interface in java.util" class="externalLink">toArray</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true#toArray(T%5B%5D)" title="class or interface in java.util" class="externalLink">toArray</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getJsonObject(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJsonObject</h4>
<pre class="methodSignature"><a href="JsonObject.html" title="interface in jakarta.json">JsonObject</a>&nbsp;getJsonObject&#8203;(int&nbsp;index)</pre>
<div class="block">Returns the object value at the specified position in this array.
This is a convenience method for <code>(JsonObject)get(index)</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the value to be returned</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value at the specified position in this array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to the JsonObject type</dd>
</dl>
</li>
</ul>
<a id="getJsonArray(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJsonArray</h4>
<pre class="methodSignature"><a href="JsonArray.html" title="interface in jakarta.json">JsonArray</a>&nbsp;getJsonArray&#8203;(int&nbsp;index)</pre>
<div class="block">Returns the array value at the specified position in this array.
This is a convenience method for <code>(JsonArray)get(index)</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the value to be returned</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value at the specified position in this array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to the JsonArray type</dd>
</dl>
</li>
</ul>
<a id="getJsonNumber(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJsonNumber</h4>
<pre class="methodSignature"><a href="JsonNumber.html" title="interface in jakarta.json">JsonNumber</a>&nbsp;getJsonNumber&#8203;(int&nbsp;index)</pre>
<div class="block">Returns the number value at the specified position in this array.
This is a convenience method for <code>(JsonNumber)get(index)</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the value to be returned</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value at the specified position in this array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to the JsonNumber type</dd>
</dl>
</li>
</ul>
<a id="getJsonString(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJsonString</h4>
<pre class="methodSignature"><a href="JsonString.html" title="interface in jakarta.json">JsonString</a>&nbsp;getJsonString&#8203;(int&nbsp;index)</pre>
<div class="block">Returns the string value at ths specified position in this array.
This is a convenience method for <code>(JsonString)get(index)</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the value to be returned</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value at the specified position in this array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to the JsonString type</dd>
</dl>
</li>
</ul>
<a id="getValuesAs(java.lang.Class)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValuesAs</h4>
<pre class="methodSignature">&lt;T extends <a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;T&gt;&nbsp;getValuesAs&#8203;(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;T&gt;&nbsp;clazz)</pre>
<div class="block">Returns a list view of the specified type for the array. This method
does not verify if there is a value of wrong type in the array. Providing
this typesafe view dynamically may cause a program fail with a
<code>ClassCastException</code>, if there is a value of wrong type in this
array. Unfortunately, the exception can occur at any time after this
method returns.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - The type of the List for the array</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>clazz</code> - a JsonValue type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a list view of the specified type</dd>
</dl>
</li>
</ul>
<a id="getValuesAs(java.util.function.Function)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValuesAs</h4>
<pre class="methodSignature">default&nbsp;&lt;T,&#8203;K extends <a href="JsonValue.html" title="interface in jakarta.json">JsonValue</a>&gt;&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;T&gt;&nbsp;getValuesAs&#8203;(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Function</a>&lt;K,&#8203;T&gt;&nbsp;func)</pre>
<div class="block">Returns a list view for the array. The value and the type of the elements
in the list is specified by the <code>func</code> argument.
<p>This method can be used to obtain a list of the unwrapped types, such as
<pre><code>
List&lt;String&gt; strings = ary1.getValuesAs(JsonString::getString);
List&lt;Integer&gt; ints = ary2.getValuesAs(JsonNumber::intValue);
</code> </pre>
or a list of simple projections, such as
<pre> <code>
List&lt;Integer&gt; stringsizes = ary1.getValueAs((JsonString v)-&gt;v.getString().length();
</code> </pre></div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>K</code> - The element type (must be a subtype of JsonValue) of this JsonArray.</dd>
<dd><code>T</code> - The element type of the returned List</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>func</code> - The function that maps the elements of this JsonArray to the target elements.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A List of the specified values and type.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the <code>JsonArray</code> contains a value of wrong type</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
</dl>
</li>
</ul>
<a id="getString(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getString</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;getString&#8203;(int&nbsp;index)</pre>
<div class="block">A convenience method for
<code>getJsonString(index).getString()</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the <code>JsonString</code> value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the String value at the specified position</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to <code>JsonString</code></dd>
</dl>
</li>
</ul>
<a id="getString(int,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getString</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;getString&#8203;(int&nbsp;index,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;defaultValue)</pre>
<div class="block">Returns the <code>String</code> value of <code>JsonString</code> at the specified
position in this JSON array values. If <code>JsonString</code> is found,
its <a href="JsonString.html#getString()"><code>JsonString.getString()</code></a> is returned. Otherwise,
the specified default value is returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the <code>JsonString</code> value</dd>
<dd><code>defaultValue</code> - the String to return if the <code>JsonValue</code> at the
specified position is not a <code>JsonString</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the String value at the specified position in this array,
or the specified default value</dd>
</dl>
</li>
</ul>
<a id="getInt(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInt</h4>
<pre class="methodSignature">int&nbsp;getInt&#8203;(int&nbsp;index)</pre>
<div class="block">A convenience method for
<code>getJsonNumber(index).intValue()</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the <code>JsonNumber</code> value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the int value at the specified position</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to <code>JsonNumber</code></dd>
</dl>
</li>
</ul>
<a id="getInt(int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInt</h4>
<pre class="methodSignature">int&nbsp;getInt&#8203;(int&nbsp;index,
int&nbsp;defaultValue)</pre>
<div class="block">Returns the int value of the <code>JsonNumber</code> at the specified position.
If the value at that position is a <code>JsonNumber</code>,
this method returns <a href="JsonNumber.html#intValue()"><code>JsonNumber.intValue()</code></a>. Otherwise
this method returns the specified default value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the <code>JsonNumber</code> value</dd>
<dd><code>defaultValue</code> - the int value to return if the <code>JsonValue</code> at
the specified position is not a <code>JsonNumber</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the int value at the specified position in this array,
or the specified default value</dd>
</dl>
</li>
</ul>
<a id="getBoolean(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBoolean</h4>
<pre class="methodSignature">boolean&nbsp;getBoolean&#8203;(int&nbsp;index)</pre>
<div class="block">Returns the boolean value at the specified position.
If the value at the specified position is <code>JsonValue.TRUE</code>
this method returns <code>true</code>. If the value at the specified position
is <code>JsonValue.FALSE</code> this method returns <code>false</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the JSON boolean value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the boolean value at the specified position</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang" class="externalLink">ClassCastException</a></code> - if the value at the specified position is not
assignable to <code>JsonValue.TRUE</code> or <code>JsonValue.FALSE</code></dd>
</dl>
</li>
</ul>
<a id="getBoolean(int,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBoolean</h4>
<pre class="methodSignature">boolean&nbsp;getBoolean&#8203;(int&nbsp;index,
boolean&nbsp;defaultValue)</pre>
<div class="block">Returns the boolean value at the specified position.
If the value at the specified position is <code>JsonValue.TRUE</code>
this method returns <code>true</code>. If the value at the specified position
is <code>JsonValue.FALSE</code> this method returns <code>false</code>.
Otherwise this method returns the specified default value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the JSON boolean value</dd>
<dd><code>defaultValue</code> - the boolean value to return if the <code>JsonValue</code>
at the specified position is neither TRUE nor FALSE</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the boolean value at the specified position,
or the specified default value</dd>
</dl>
</li>
</ul>
<a id="isNull(int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isNull</h4>
<pre class="methodSignature">boolean&nbsp;isNull&#8203;(int&nbsp;index)</pre>
<div class="block">Returns <code>true</code> if the value at the specified location in this
array is <code>JsonValue.NULL</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>index</code> - index of the JSON null value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>return true if the value at the specified location is
<code>JsonValue.NULL</code>, otherwise false</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IndexOutOfBoundsException</a></code> - if the index is out of range</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JsonArray.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><br>JSON Processing API v2.0.0</div>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Comments to: <a href="mailto:jsonp-dev@eclipse.org">jsonp-dev@eclipse.org</a>.<br> Copyright &#169; 2019, 2020 Eclipse Foundation. All rights reserved.<br> Use is subject to <a href="../../../doc-files/speclicense.html" target="_top">license terms</a>.</small></p>
</footer>
</body>
</html>