-
- All Implemented Interfaces:
-
io.github.millibyte1.array64.Array64Iterator
,io.github.millibyte1.array64.LongIndexedIterator
,io.github.millibyte1.array64.atomic.AtomicArray64Iterator
,kotlin.collections.Iterator
public abstract class AtomicIntArray64Iterator extends IntArray64Iterator implements AtomicArray64Iterator<Int>
A IntArray64Iterator which supports atomic operations such as compareAndSet.
-
-
Constructor Summary
Constructors Constructor Description AtomicIntArray64Iterator()
-
Method Summary
Modifier and Type Method Description abstract Long
getIndex()
The current index of this iterator. abstract Integer
previousInt()
Returns the next element in the iteration without boxing. abstract Integer
nextInt()
Returns the previous element in the iteration without boxing. abstract Unit
setInt(Integer element)
Replaces the element at the current index with the specified primitive. abstract Integer
getAndSetInt(Integer new)
Sets the element at the current index to the given new value and returns the old value. abstract Integer
getAndSetInt(Function1<Integer, Integer> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. abstract Integer
setAndGetInt(Function1<Integer, Integer> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. abstract Boolean
compareAndSetInt(Integer new, Integer expected)
Sets the element at the current index to the given new value if the current value matches expected. abstract Boolean
compareAndSetInt(Integer new, Function2<Integer, Integer, Boolean> predicate)
Sets the element at the current index to the given new value if the provided predicate returns true when applied to the old and new values. abstract Unit
lazySetInt(Integer value)
Eventually sets the element at the given index to the given value. final Integer
getAndSet(Integer new)
Sets the element at the current index to the given new value and returns the old value. final Integer
getAndSet(Function1<Integer, Integer> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. final Integer
setAndGet(Function1<Integer, Integer> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. final Boolean
compareAndSet(Integer new, Integer expected)
Sets the element at the current index to the given new value if the current value matches expected. final Boolean
compareAndSet(Integer new, Function2<Integer, Integer, Boolean> predicate)
Sets the element at the current index to the given new value if the provided predicate returns true when applied to the old and new values. final Unit
lazySet(Integer value)
Eventually sets the element at the given index to the given value. -
Methods inherited from class io.github.millibyte1.array64.atomic.AtomicIntArray64Iterator
previous, set
-
Methods inherited from class kotlin.collections.IntIterator
forEachRemaining, hasNext
-
Methods inherited from class io.github.millibyte1.array64.IntArray64Iterator
hasPrevious, next
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
previousInt
abstract Integer previousInt()
Returns the next element in the iteration without boxing. Volatile.
-
nextInt
abstract Integer nextInt()
Returns the previous element in the iteration without boxing. Volatile.
-
setInt
abstract Unit setInt(Integer element)
Replaces the element at the current index with the specified primitive. Volatile.
-
getAndSetInt
abstract Integer getAndSetInt(Integer new)
Sets the element at the current index to the given new value and returns the old value. Atomic.
- Parameters:
new
- the value to set the element to
-
getAndSetInt
abstract Integer getAndSetInt(Function1<Integer, Integer> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. Atomic.
- Parameters:
transform
- the pure (side effect-free) transform function to apply to the old value
-
setAndGetInt
abstract Integer setAndGetInt(Function1<Integer, Integer> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. Atomic.
- Parameters:
transform
- the pure (side effect-free) transform function to apply to the old value
-
compareAndSetInt
abstract Boolean compareAndSetInt(Integer new, Integer expected)
Sets the element at the current index to the given new value if the current value matches expected. Atomic.
- Parameters:
new
- the value to set the element toexpected
- the expected value of the element
-
compareAndSetInt
abstract Boolean compareAndSetInt(Integer new, Function2<Integer, Integer, Boolean> predicate)
Sets the element at the current index to the given new value if the provided predicate returns true when applied to the old and new values.
- Parameters:
new
- the value to set the element topredicate
- the binary predicate to apply to the old and new values to decide whether to update
-
lazySetInt
abstract Unit lazySetInt(Integer value)
Eventually sets the element at the given index to the given value. Depending on the implementation, may immediately perform a volatile write.
- Parameters:
value
- the value to set the element to
-
getAndSet
final Integer getAndSet(Integer new)
Sets the element at the current index to the given new value and returns the old value. Atomic.
- Parameters:
new
- the value to set the element to
-
getAndSet
final Integer getAndSet(Function1<Integer, Integer> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. Atomic.
- Parameters:
transform
- the pure (side effect-free) transform function to apply to the old value
-
setAndGet
final Integer setAndGet(Function1<Integer, Integer> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. Atomic.
- Parameters:
transform
- the pure (side effect-free) transform function to apply to the old value
-
compareAndSet
final Boolean compareAndSet(Integer new, Integer expected)
Sets the element at the current index to the given new value if the current value matches expected. Atomic.
- Parameters:
new
- the value to set the element toexpected
- the expected value of the element
-
compareAndSet
final Boolean compareAndSet(Integer new, Function2<Integer, Integer, Boolean> predicate)
Sets the element at the current index to the given new value if the provided predicate returns true when applied to the old and new values.
- Parameters:
new
- the value to set the element topredicate
- the binary predicate to apply to the old and new values to decide whether to update
-
-
-
-