-
- All Implemented Interfaces:
-
io.github.millibyte1.array64.Array64
,io.github.millibyte1.array64.atomic.AtomicArray64
,kotlin.collections.Iterable
public interface AtomicShortArray64 implements AtomicArray64<Short>
Marker interface for AtomicArray64s of unboxed primitive Shorts.
-
-
Method Summary
Modifier and Type Method Description abstract Short
get(Long index)
Returns the element at the given index. abstract Unit
set(Long index, Short value)
Sets the element at the given index to the given value. abstract Short
getAndSet(Long index, Short new)
Sets the element at position index to the given new value and returns the old value. abstract Short
getAndSet(Long index, Function1<Short, Short> transform)
Sets the element at position index to the value resulting from applying the given transform to the old value. abstract Short
setAndGet(Long index, Function1<Short, Short> transform)
Sets the element at position index to the resulting value from applying the given transform to the old value. abstract Boolean
compareAndSet(Long index, Short new, Short expected)
Sets the element at position index to the given new value if the current value matches expected. abstract Boolean
compareAndSet(Long index, Short new, Function2<Short, Short, Boolean> predicate)
Sets the element at position index to the given new value if the provided predicate returns true when applied to the old and new values. abstract Unit
lazySet(Long index, Short value)
Eventually sets the element at the given index to the given value. abstract AtomicShortArray64Iterator
iterator()
Returns an iterator to the first element of this array which supports volatile and atomic operations. abstract AtomicShortArray64Iterator
iterator(Long index)
Returns an iterator to the element at the given index which supports volatile and atomic operations. abstract Long
size()
The number of elements in this array. -
Methods inherited from class io.github.millibyte1.array64.atomic.AtomicArray64
copy
-
Methods inherited from class io.github.millibyte1.array64.Array64
forEach, spliterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
get
abstract Short get(Long index)
Returns the element at the given index. Volatile.
- Parameters:
index
- the index of the desired element
-
set
abstract Unit set(Long index, Short value)
- Parameters:
index
- the index of the element to setvalue
- the value to set the element to
-
getAndSet
abstract Short getAndSet(Long index, Short new)
- Parameters:
index
- the index of the element to setnew
- the value to set the element to
-
getAndSet
abstract Short getAndSet(Long index, Function1<Short, Short> transform)
Sets the element at position index to the value resulting from applying the given transform to the old value. Atomic.
- Parameters:
index
- the index of the element to settransform
- the pure (side effect-free) transform function to apply to the old value
-
setAndGet
abstract Short setAndGet(Long index, Function1<Short, Short> transform)
Sets the element at position index to the resulting value from applying the given transform to the old value. Atomic.
- Parameters:
index
- the index of the element to settransform
- the pure (side effect-free) transform function to apply to the old value
-
compareAndSet
abstract Boolean compareAndSet(Long index, Short new, Short expected)
Sets the element at position index to the given new value if the current value matches expected. Atomic.
- Parameters:
index
- the index of the element to try and setnew
- the value to set the element toexpected
- the expected value of the element
-
compareAndSet
abstract Boolean compareAndSet(Long index, Short new, Function2<Short, Short, Boolean> predicate)
Sets the element at position index to the given new value if the provided predicate returns true when applied to the old and new values.
- Parameters:
index
- the index of the element to try and setnew
- the value to set the element topredicate
- the binary predicate to apply to the old and new values to decide whether to update
-
lazySet
abstract Unit lazySet(Long index, Short value)
Eventually sets the element at the given index to the given value. Depending on the implementation, may immediately perform a volatile write.
- Parameters:
index
- the index of the element to setvalue
- the value to set the element to
-
iterator
abstract AtomicShortArray64Iterator iterator()
Returns an iterator to the first element of this array which supports volatile and atomic operations.
-
iterator
abstract AtomicShortArray64Iterator iterator(Long index)
Returns an iterator to the element at the given index which supports volatile and atomic operations.
-
-
-
-