Interface ObservableIntegerArray
All Superinterfaces:
All Known Subinterfaces:
public interface ObservableIntegerArray extends ObservableArray<ObservableIntegerArray>
ObservableIntegerArray is a int[] array that allows listeners to track changes when they occur. In order to track changes, the internal array is encapsulated and there is no direct access available from the outside. Bulk operations are supported but they always do a copy of the data range.Since:
JavaFX 8.0
See Also:
-
Method Summary
All MethodsInstance MethodsAbstract Methods Modifier and Type Method and Description voidaddAll(int... elements)Appends givenelementsto the end of this array.voidaddAll(int[] src, int srcIndex, int length)Appends a portion of given array to the end of this array.voidaddAll(ObservableIntegerArray src)Appends content of a given observable array to the end of this array.voidaddAll(ObservableIntegerArray src, int srcIndex, int length)Appends a portion of given observable array to the end of this array.voidcopyTo(int srcIndex, int[] dest, int destIndex, int length)Copies specified portion of array intodestarray.voidcopyTo(int srcIndex, ObservableIntegerArray dest, int destIndex, int length)Copies specified portion of array intodestobservable array.intget(int index)Gets a single value of array.voidset(int index, int value)Sets a single value in the array.voidset(int destIndex, int[] src, int srcIndex, int length)Copies a portion of specified array into this observable array.voidset(int destIndex, ObservableIntegerArray src, int srcIndex, int length)Copies a portion of specified observable array into this observable array.voidsetAll(int... elements)Replaces this observable array content with given elements.voidsetAll(int[] src, int srcIndex, int length)Replaces this observable array content with a copy of portion of a given array.voidsetAll(ObservableIntegerArray src)Replaces this observable array content with a copy of given observable array.voidsetAll(ObservableIntegerArray src, int srcIndex, int length)Replaces this observable array content with a portion of a given observable array.int[]toArray(int[] dest)Returns an array containing copy of the observable array.int[]toArray(int srcIndex, int[] dest, int length)Returns an array containing copy of specified portion of the observable array.-
Methods inherited from interface javafx.collections.ObservableArray
addListener, clear, ensureCapacity, removeListener, resize, size, trimToSize
-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
-
Method Detail
-
copyTo
void copyTo(int srcIndex, int[] dest, int destIndex, int length)Copies specified portion of array intodestarray. Throws the same exceptions asSystem.arraycopy()method.Parameters:
srcIndex- starting position in the observable array
-
copyTo
void copyTo(int srcIndex, ObservableIntegerArray dest, int destIndex, int length)Copies specified portion of array intodestobservable array. Throws the same exceptions asSystem.arraycopy()method.Parameters:
srcIndex- starting position in the observable array
-
get
int get(int index)
Gets a single value of array. This is generally as fast as direct access to an array and eliminates necessity to make a copy of array.Parameters:
index- index of element to getReturns:
value at the given index
Throws:
ArrayIndexOutOfBoundsException- ifindexis outside array bounds
-
addAll
void addAll(int... elements)
Appends givenelementsto the end of this array. Capacity is increased if necessary to match the new size of the data.Parameters:
elements- elements to append
-
addAll
void addAll(ObservableIntegerArray src)
Appends content of a given observable array to the end of this array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- observable array with elements to append
-
addAll
void addAll(int[] src, int srcIndex, int length)Appends a portion of given array to the end of this array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- source array
-
addAll
void addAll(ObservableIntegerArray src, int srcIndex, int length)Appends a portion of given observable array to the end of this array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- source observable array
-
setAll
void setAll(int... elements)
Replaces this observable array content with given elements. Capacity is increased if necessary to match the new size of the data.Parameters:
elements- elements to put into array contentThrows:
NullPointerException- ifsrcis null
-
setAll
void setAll(int[] src, int srcIndex, int length)Replaces this observable array content with a copy of portion of a given array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- source array to copy.Throws:
NullPointerException- ifsrcis null
-
setAll
void setAll(ObservableIntegerArray src)
Replaces this observable array content with a copy of given observable array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- source observable array to copy.Throws:
NullPointerException- ifsrcis null
-
setAll
void setAll(ObservableIntegerArray src, int srcIndex, int length)Replaces this observable array content with a portion of a given observable array. Capacity is increased if necessary to match the new size of the data.Parameters:
src- source observable array to copy.Throws:
NullPointerException- ifsrcis null
-
set
void set(int destIndex, int[] src, int srcIndex, int length)Copies a portion of specified array into this observable array. Throws the same exceptions asSystem.arraycopy()method.Parameters:
destIndex- the starting destination position in this observable array
-
set
void set(int destIndex, ObservableIntegerArray src, int srcIndex, int length)Copies a portion of specified observable array into this observable array. Throws the same exceptions asSystem.arraycopy()method.Parameters:
destIndex- the starting destination position in this observable array
-
set
void set(int index, int value)Sets a single value in the array. Avoid using this method if many values are updated, use #setAll(int, int[], int, int) update method instead with as minimum number of invocations as possible.Parameters:
index- index of the value to setThrows:
ArrayIndexOutOfBoundsException- ifindexis outside array bounds
-
toArray
int[] toArray(int[] dest)
Returns an array containing copy of the observable array. If the observable array fits in the specified array, it is copied therein. Otherwise, a new array is allocated with the size of the observable array.Parameters:
dest- the array into which the observable array to be copied, if it is big enough; otherwise, a new int array is allocated. Ignored, if null.Returns:
an int array containing the copy of the observable array
-
toArray
int[] toArray(int srcIndex, int[] dest, int length)Returns an array containing copy of specified portion of the observable array. If specified portion of the observable array fits in the specified array, it is copied therein. Otherwise, a new array of given length is allocated.Parameters:
srcIndex- starting position in the observable arrayReturns:
an int array containing the copy of specified portion the observable array
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.