MaxSizedIntArrayList (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.internal.hppc, class: MaxSizedIntArrayList

Package org.apache.lucene.internal.hppc

# Class MaxSizedIntArrayList

java.lang.Object
org.apache.lucene.internal.hppc.IntArrayList
org.apache.lucene.internal.hppc.MaxSizedIntArrayList

All Implemented Interfaces:
  `Cloneable`, `Iterable<IntCursor>`, `Accountable`

public class MaxSizedIntArrayList extends IntArrayList
An array-backed list of `int` with a maximum size limit.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.internal.hppc.IntArrayList

  `buffer, elementsCount, EMPTY_ARRAY`

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MaxSizedIntArrayList(int maxSize)`
  New instance with sane defaults.
  `MaxSizedIntArrayList(int maxSize, int expectedElements)`
  New instance with sane defaults.
  `MaxSizedIntArrayList(MaxSizedIntArrayList list)`
  Creates a new list from the elements of another list in its iteration order.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `ensureBufferSpace(int expectedAdditions)`
  Ensures the internal buffer has enough free slots to store `expectedAdditions`.
  `boolean`
  `equals(Object obj)`
  Returns `true` only if the other object is an instance of the same class and with the same elements and maxSize.
  `int`
  `hashCode()`
  `long`
  `ramBytesUsed()`
  Returns an estimate of the JVM heap memory used by this object in bytes.

  ### Methods inherited from class org.apache.lucene.internal.hppc.IntArrayList

  `add, add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equalElements, from, get, indexOf, insert, isEmpty, iterator, lastIndexOf, release, removeAll, removeAt, removeElement, removeFirst, removeLast, removeLast, removeRange, resize, reverse, set, size, sort, stream, toArray, toString, trimToSize`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.lucene.util.Accountable

  `getChildResources`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Constructor Details

  - ### MaxSizedIntArrayList

    public MaxSizedIntArrayList(int maxSize)
    New instance with sane defaults.

  - ### MaxSizedIntArrayList

    public MaxSizedIntArrayList(int maxSize, int expectedElements)
    New instance with sane defaults.
    Parameters:
      `maxSize` - The maximum size this list can grow to
      `expectedElements` - The expected number of elements guaranteed not to cause buffer expansion (inclusive).

  - ### MaxSizedIntArrayList

    public MaxSizedIntArrayList(MaxSizedIntArrayList list)
    Creates a new list from the elements of another list in its iteration order.

- ## Method Details

  - ### ensureBufferSpace

    protected void ensureBufferSpace(int expectedAdditions)
    Description copied from class: `IntArrayList`
    Ensures the internal buffer has enough free slots to store `expectedAdditions`. Increases internal buffer size if needed.
    Overrides:
      `ensureBufferSpace` in class `IntArrayList`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `IntArrayList`

  - ### equals

    public boolean equals(Object obj)
    Returns `true` only if the other object is an instance of the same class and with the same elements and maxSize.
    Overrides:
      `equals` in class `IntArrayList`

  - ### ramBytesUsed

    public long ramBytesUsed()
    Description copied from interface: `Accountable`
    Returns an estimate of the JVM heap memory used by this object in bytes. The method name uses "ram" for historical reasons; only JVM heap memory should be reported. Off-heap resources such as memory-mapped files or native direct buffers should not be included. Negative values are illegal.
    Specified by:
      `ramBytesUsed` in interface `Accountable`
    Overrides:
      `ramBytesUsed` in class `IntArrayList`