-
- 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 AtomicLongArray64Iterator extends LongArray64Iterator implements AtomicArray64Iterator<Long>
A LongArray64Iterator which supports atomic operations such as compareAndSet.
-
-
Constructor Summary
Constructors Constructor Description AtomicLongArray64Iterator()
-
Method Summary
Modifier and Type Method Description abstract Long
getIndex()
The current index of this iterator. abstract Long
previousLong()
Returns the next element in the iteration without boxing. abstract Long
nextLong()
Returns the previous element in the iteration without boxing. abstract Unit
setLong(Long element)
Replaces the element at the current index with the specified primitive. abstract Long
getAndSetLong(Long new)
Sets the element at the current index to the given new value and returns the old value. abstract Long
getAndSetLong(Function1<Long, Long> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. abstract Long
setAndGetLong(Function1<Long, Long> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. abstract Boolean
compareAndSetLong(Long new, Long expected)
Sets the element at the current index to the given new value if the current value matches expected. abstract Boolean
compareAndSetLong(Long new, Function2<Long, Long, 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
lazySetLong(Long value)
Eventually sets the element at the given index to the given value. final Long
getAndSet(Long new)
Sets the element at the current index to the given new value and returns the old value. final Long
getAndSet(Function1<Long, Long> transform)
Sets the element at the current index to the value resulting from applying the given transform to the old value. final Long
setAndGet(Function1<Long, Long> transform)
Sets the element at the current index to the resulting value from applying the given transform to the old value. final Boolean
compareAndSet(Long new, Long expected)
Sets the element at the current index to the given new value if the current value matches expected. final Boolean
compareAndSet(Long new, Function2<Long, Long, 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(Long value)
Eventually sets the element at the given index to the given value. -
Methods inherited from class io.github.millibyte1.array64.atomic.AtomicLongArray64Iterator
previous, set
-
Methods inherited from class kotlin.collections.LongIterator
forEachRemaining, hasNext
-
Methods inherited from class io.github.millibyte1.array64.LongArray64Iterator
hasPrevious, next
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
previousLong
abstract Long previousLong()
Returns the next element in the iteration without boxing. Volatile.
-
nextLong
abstract Long nextLong()
Returns the previous element in the iteration without boxing. Volatile.
-
setLong
abstract Unit setLong(Long element)
Replaces the element at the current index with the specified primitive. Volatile.
-
getAndSetLong
abstract Long getAndSetLong(Long 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
-
getAndSetLong
abstract Long getAndSetLong(Function1<Long, Long> 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
-
setAndGetLong
abstract Long setAndGetLong(Function1<Long, Long> 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
-
compareAndSetLong
abstract Boolean compareAndSetLong(Long new, Long 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
-
compareAndSetLong
abstract Boolean compareAndSetLong(Long new, Function2<Long, Long, 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
-
lazySetLong
abstract Unit lazySetLong(Long 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 Long getAndSet(Long 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 Long getAndSet(Function1<Long, Long> 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 Long setAndGet(Function1<Long, Long> 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(Long new, Long 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(Long new, Function2<Long, Long, 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
-
-
-
-