Package net.algart.arrays
Interface ArrayExchanger
- All Known Subinterfaces:
ArrayExchanger32
,MutableArray
,MutableBitArray
,MutableByteArray
,MutableCharArray
,MutableDoubleArray
,MutableFloatArray
,MutableIntArray
,MutableLongArray
,MutableObjectArray<E>
,MutableObjectInPlaceArray<E>
,MutablePArray
,MutablePFixedArray
,MutablePFloatingArray
,MutablePIntegerArray
,MutablePNumberArray
,MutableShortArray
,UpdatableArray
,UpdatableBitArray
,UpdatableByteArray
,UpdatableCharArray
,UpdatableDoubleArray
,UpdatableFloatArray
,UpdatableIntArray
,UpdatableLongArray
,UpdatableObjectArray<E>
,UpdatableObjectInPlaceArray<E>
,UpdatablePArray
,UpdatablePFixedArray
,UpdatablePFloatingArray
,UpdatablePIntegerArray
,UpdatablePNumberArray
,UpdatableShortArray
- All Known Implementing Classes:
AbstractUpdatableBitArray
,AbstractUpdatableByteArray
,AbstractUpdatableCharArray
,AbstractUpdatableDoubleArray
,AbstractUpdatableFloatArray
,AbstractUpdatableIntArray
,AbstractUpdatableLongArray
,AbstractUpdatableObjectArray
,AbstractUpdatableShortArray
,JArrays.ByteAndIndexArrayExchanger
,JArrays.ByteArrayExchanger
,JArrays.CharAndIndexArrayExchanger
,JArrays.CharArrayExchanger
,JArrays.DoubleAndIndexArrayExchanger
,JArrays.DoubleArrayExchanger
,JArrays.FloatAndIndexArrayExchanger
,JArrays.FloatArrayExchanger
,JArrays.IntAndIndexArrayExchanger
,JArrays.IntArrayExchanger
,JArrays.LongAndIndexArrayExchanger
,JArrays.LongArrayExchanger
,JArrays.ShortAndIndexArrayExchanger
,JArrays.ShortArrayExchanger
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Exchanging interface, designed for exchanging (swapping) two elements in some data array.
The basic method swap(long, long)
of this interface works with indexes of the exchanged elements in the array.
So, every object, implementing this interface, is supposed to be working with some fixed linear data array.
The method of storing data in the array can be any; for example, it can be an
updatable AlgART array
or a usual Java array.
The length of the array is limited only by 263−1 (maximal possible value for long
indexes).
This interface is used by ArraySorter
class.
Note: UpdatableArray
interface extends this interface.
In JArrays
class you will find implementations of this interface for processing usual Java arrays.
- Author:
- Daniel Alievsky
-
Method Summary
Modifier and TypeMethodDescriptionvoid
swap
(long firstIndex, long secondIndex) Should exchange the elements at position firstIndex and secondIndex in the data array.
-
Method Details
-
swap
void swap(long firstIndex, long secondIndex) Should exchange the elements at position firstIndex and secondIndex in the data array.- Parameters:
firstIndex
- index of the first exchanged element.secondIndex
- index of the second exchanged element.
-