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