blob: 2a0d5df6466e75a0921995ff612a7c55f210fb05 [file]
<html devsite="true">
<head>
<title>CircularArray</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div itemscope="" itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="CircularArray">
<meta itemprop="path" content="androidx.collection">
<meta itemprop="property" content="addFirst(kotlin.Any)">
<meta itemprop="property" content="addLast(kotlin.Any)">
<meta itemprop="property" content="clear()">
<meta itemprop="property" content="get(kotlin.Int)">
<meta itemprop="property" content="getFirst()">
<meta itemprop="property" content="getLast()">
<meta itemprop="property" content="isEmpty()">
<meta itemprop="property" content="popFirst()">
<meta itemprop="property" content="popLast()">
<meta itemprop="property" content="removeFromEnd(kotlin.Int)">
<meta itemprop="property" content="removeFromStart(kotlin.Int)">
<meta itemprop="property" content="size()">
<meta itemprop="language" content="JAVA">
</div>
<div id="header-block">
<div>
<h1>CircularArray</h1>
</div>
<div id="metadata-info-block">
<div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/collection/CircularArray.kt+class:androidx.collection.CircularArray&amp;ss=androidx/platform/frameworks/support" class="external">View Source</a></div>
</div>
</div>
<div id="refdoc-switcher-placeholder"></div>
<p>
<pre>public final class <a href="/reference/androidx/collection/CircularArray.html">CircularArray</a>&lt;E&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<hr>
<p>CircularArray is a generic circular array data structure that provides O(1) random read, O(1) prepend and O(1) append. The CircularArray automatically grows its capacity when number of added items is over its capacity.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>&lt;E&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/collection/CircularArray.html#CircularArray(kotlin.Int)">CircularArray</a>(int&nbsp;minCapacity)</code></div>
<p>Creates a circular array with capacity for at least <code><a href="/reference/androidx/collection/CircularArray.html#&lt;init&gt;(kotlin.Int)">minCapacity</a></code> elements.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#addFirst(kotlin.Any)">addFirst</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element)</code></div>
<p>Add an element in front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#addLast(kotlin.Any)">addLast</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element)</code></div>
<p>Add an element at end of the CircularArray.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#clear()">clear</a>()</code></div>
<p>Remove all elements from the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#get(kotlin.Int)">get</a>(int&nbsp;index)</code></div>
<p>Get nth (0 <= n <= size()-1) element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#getFirst()">getFirst</a>()</code></div>
<p>Get first element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#getLast()">getLast</a>()</code></div>
<p>Get last element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#isEmpty()">isEmpty</a>()</code></div>
<p>Return <code>true</code> if <code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a></code> is 0.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#popFirst()">popFirst</a>()</code></div>
<p>Remove first element from front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> and return it.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#popLast()">popLast</a>()</code></div>
<p>Remove last element from end of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> and return it.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#removeFromEnd(kotlin.Int)">removeFromEnd</a>(int&nbsp;count)</code></div>
<p>Remove multiple elements from end of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>, ignore when <code><a href="/reference/androidx/collection/CircularArray.html#removeFromEnd(kotlin.Int)">count</a></code> is less than or equals to 0.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#removeFromStart(kotlin.Int)">removeFromStart</a>(int&nbsp;count)</code></div>
<p>Remove multiple elements from front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>, ignore when <code><a href="/reference/androidx/collection/CircularArray.html#removeFromStart(kotlin.Int)">count</a></code> is less than or equal to 0.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td>
<div><code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a>()</code></div>
<p>Get number of elements in the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="CircularArray-kotlin.Int-"></a><a name="circulararray"></a>
<div class="api-name-block">
<div>
<h3 id="CircularArray(kotlin.Int)">CircularArray</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;&lt;E&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/collection/CircularArray.html#CircularArray(kotlin.Int)">CircularArray</a>(int&nbsp;minCapacity)</pre>
<p>Creates a circular array with capacity for at least <code><a href="/reference/androidx/collection/CircularArray.html#&lt;init&gt;(kotlin.Int)">minCapacity</a></code> elements.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>int&nbsp;minCapacity</code></td>
<td>
<p>the minimum capacity, between 1 and 2^30 inclusive</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="list">
<h2>Public methods</h2>
<div class="api-item"><a name="addFirst-kotlin.Any-"></a><a name="addfirst"></a>
<div class="api-name-block">
<div>
<h3 id="addFirst(kotlin.Any)">addFirst</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/collection/CircularArray.html#addFirst(kotlin.Any)">addFirst</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element)</pre>
<p>Add an element in front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element</code></td>
<td>
<p>Element to add.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="addLast-kotlin.Any-"></a><a name="addlast"></a>
<div class="api-name-block">
<div>
<h3 id="addLast(kotlin.Any)">addLast</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/collection/CircularArray.html#addLast(kotlin.Any)">addLast</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element)</pre>
<p>Add an element at end of the CircularArray.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;element</code></td>
<td>
<p>Element to add.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="clear--"></a><a name="clear"></a>
<div class="api-name-block">
<div>
<h3 id="clear()">clear</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/collection/CircularArray.html#clear()">clear</a>()</pre>
<p>Remove all elements from the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</div>
<div class="api-item"><a name="get-kotlin.Int-"></a><a name="get"></a>
<div class="api-name-block">
<div>
<h3 id="get(kotlin.Int)">get</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;<a href="/reference/androidx/collection/CircularArray.html#get(kotlin.Int)">get</a>(int&nbsp;index)</pre>
<p>Get nth (0 <= n <= size()-1) element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>int&nbsp;index</code></td>
<td>
<p>The zero based element index in the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<p>The nth element.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if n < 0 or n >= size()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="getFirst--"></a><a name="getfirst"></a>
<div class="api-name-block">
<div>
<h3 id="getFirst()">getFirst</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;<a href="/reference/androidx/collection/CircularArray.html#getFirst()">getFirst</a>()</pre>
<p>Get first element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<p>The first element.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> is empty</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="getLast--"></a><a name="getlast"></a>
<div class="api-name-block">
<div>
<h3 id="getLast()">getLast</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;<a href="/reference/androidx/collection/CircularArray.html#getLast()">getLast</a>()</pre>
<p>Get last element of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<p>The last element.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> is empty</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="isEmpty--"></a><a name="isempty"></a>
<div class="api-name-block">
<div>
<h3 id="isEmpty()">isEmpty</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/collection/CircularArray.html#isEmpty()">isEmpty</a>()</pre>
<p>Return <code>true</code> if <code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a></code> is 0.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>boolean</code></td>
<td>
<p><code>true</code> if <code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a></code> is 0.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="popFirst--"></a><a name="popfirst"></a>
<div class="api-name-block">
<div>
<h3 id="popFirst()">popFirst</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;<a href="/reference/androidx/collection/CircularArray.html#popFirst()">popFirst</a>()</pre>
<p>Remove first element from front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> and return it.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<p>The element removed.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> is empty (on jvm)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="popLast--"></a><a name="poplast"></a>
<div class="api-name-block">
<div>
<h3 id="popLast()">popLast</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E&nbsp;<a href="/reference/androidx/collection/CircularArray.html#popLast()">popLast</a>()</pre>
<p>Remove last element from end of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> and return it.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> E</code></td>
<td>
<p>The element removed.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code> is empty</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="removeFromEnd-kotlin.Int-"></a><a name="removefromend"></a>
<div class="api-name-block">
<div>
<h3 id="removeFromEnd(kotlin.Int)">removeFromEnd</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/collection/CircularArray.html#removeFromEnd(kotlin.Int)">removeFromEnd</a>(int&nbsp;count)</pre>
<p>Remove multiple elements from end of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>, ignore when <code><a href="/reference/androidx/collection/CircularArray.html#removeFromEnd(kotlin.Int)">count</a></code> is less than or equals to 0.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>int&nbsp;count</code></td>
<td>
<p>Number of elements to remove.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html#removeFromEnd(kotlin.Int)">count</a></code> is larger than <code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a></code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="removeFromStart-kotlin.Int-"></a><a name="removefromstart"></a>
<div class="api-name-block">
<div>
<h3 id="removeFromStart(kotlin.Int)">removeFromStart</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/collection/CircularArray.html#removeFromStart(kotlin.Int)">removeFromStart</a>(int&nbsp;count)</pre>
<p>Remove multiple elements from front of the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>, ignore when <code><a href="/reference/androidx/collection/CircularArray.html#removeFromStart(kotlin.Int)">count</a></code> is less than or equal to 0.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>int&nbsp;count</code></td>
<td>
<p>Number of elements to remove.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-index-out-of-bounds-exception/index.html">kotlin.IndexOutOfBoundsException</a></code></td>
<td>
<p>if <code><a href="/reference/androidx/collection/CircularArray.html#removeFromStart(kotlin.Int)">count</a></code> is larger than <code><a href="/reference/androidx/collection/CircularArray.html#size()">size</a></code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="size--"></a><a name="size"></a>
<div class="api-name-block">
<div>
<h3 id="size()">size</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/collection/CircularArray.html#size()">size</a>()</pre>
<p>Get number of elements in the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>int</code></td>
<td>
<p>Number of elements in the <code><a href="/reference/androidx/collection/CircularArray.html">CircularArray</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>