Package org.apache.lucene.internal.hppc
Class MaxSizedFloatArrayList
java.lang.Object
org.apache.lucene.internal.hppc.FloatArrayList
org.apache.lucene.internal.hppc.MaxSizedFloatArrayList
- All Implemented Interfaces:
Cloneable,Iterable<FloatCursor>,Accountable
An array-backed list of
float 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.FloatArrayList
buffer, elementsCount, EMPTY_ARRAYFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionMaxSizedFloatArrayList(int maxSize) New instance with sane defaults.MaxSizedFloatArrayList(int maxSize, int expectedElements) New instance with sane defaults.Creates a new list from the elements of another list in its iteration order. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidensureBufferSpace(int expectedAdditions) Ensures the internal buffer has enough free slots to storeexpectedAdditions.booleanReturnstrueonly if the other object is an instance of the same class and with the same elements and maxSize.inthashCode()longReturn the memory usage of this object in bytes.Methods inherited from class org.apache.lucene.internal.hppc.FloatArrayList
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, toArray, toString, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MaxSizedFloatArrayList
public MaxSizedFloatArrayList(int maxSize) New instance with sane defaults. -
MaxSizedFloatArrayList
public MaxSizedFloatArrayList(int maxSize, int expectedElements) New instance with sane defaults.- Parameters:
maxSize- The maximum size this list can grow toexpectedElements- The expected number of elements guaranteed not to cause buffer expansion (inclusive).
-
MaxSizedFloatArrayList
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:FloatArrayListEnsures the internal buffer has enough free slots to storeexpectedAdditions. Increases internal buffer size if needed.- Overrides:
ensureBufferSpacein classFloatArrayList
-
hashCode
public int hashCode()- Overrides:
hashCodein classFloatArrayList
-
equals
Returnstrueonly if the other object is an instance of the same class and with the same elements and maxSize.- Overrides:
equalsin classFloatArrayList
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable- Overrides:
ramBytesUsedin classFloatArrayList
-