Package 

Class AtomicShortArray64Iterator

  • 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 AtomicShortArray64Iterator
    extends ShortArray64Iterator implements AtomicArray64Iterator<Short>
                        

    A ShortArray64Iterator which supports atomic operations such as compareAndSet.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Long index
    • Method Summary

      Modifier and Type Method Description
      abstract Long getIndex() The current index of this iterator.
      abstract Short previousShort() Returns the next element in the iteration without boxing.
      abstract Short nextShort() Returns the previous element in the iteration without boxing.
      abstract Unit setShort(Short element) Replaces the element at the current index with the specified primitive.
      abstract Short getAndSetShort(Short new) Sets the element at the current index to the given new value and returns the old value.
      abstract Short getAndSetShort(Function1<Short, Short> transform) Sets the element at the current index to the value resulting from applying the given transform to the old value.
      abstract Short setAndGetShort(Function1<Short, Short> transform) Sets the element at the current index to the resulting value from applying the given transform to the old value.
      abstract Boolean compareAndSetShort(Short new, Short expected) Sets the element at the current index to the given new value if the current value matches expected.
      abstract Boolean compareAndSetShort(Short new, Function2<Short, Short, 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 lazySetShort(Short value) Eventually sets the element at the given index to the given value.
      final Short getAndSet(Short new) Sets the element at the current index to the given new value and returns the old value.
      final Short getAndSet(Function1<Short, Short> transform) Sets the element at the current index to the value resulting from applying the given transform to the old value.
      final Short setAndGet(Function1<Short, Short> transform) Sets the element at the current index to the resulting value from applying the given transform to the old value.
      final Boolean compareAndSet(Short new, Short expected) Sets the element at the current index to the given new value if the current value matches expected.
      final Boolean compareAndSet(Short new, Function2<Short, Short, 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(Short value) Eventually sets the element at the given index to the given value.
      • Methods inherited from class io.github.millibyte1.array64.atomic.AtomicShortArray64Iterator

        previous, set
      • Methods inherited from class kotlin.collections.ShortIterator

        forEachRemaining, hasNext
      • Methods inherited from class io.github.millibyte1.array64.ShortArray64Iterator

        hasPrevious, next
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AtomicShortArray64Iterator

        AtomicShortArray64Iterator()
    • Method Detail

      • getIndex

         abstract Long getIndex()

        The current index of this iterator.

      • previousShort

         abstract Short previousShort()

        Returns the next element in the iteration without boxing. Volatile.

      • nextShort

         abstract Short nextShort()

        Returns the previous element in the iteration without boxing. Volatile.

      • setShort

         abstract Unit setShort(Short element)

        Replaces the element at the current index with the specified primitive. Volatile.

      • getAndSetShort

         abstract Short getAndSetShort(Short 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
      • getAndSetShort

         abstract Short getAndSetShort(Function1<Short, Short> 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
      • setAndGetShort

         abstract Short setAndGetShort(Function1<Short, Short> 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
      • compareAndSetShort

         abstract Boolean compareAndSetShort(Short new, Short 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 to
        expected - the expected value of the element
      • compareAndSetShort

         abstract Boolean compareAndSetShort(Short new, Function2<Short, Short, 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 to
        predicate - the binary predicate to apply to the old and new values to decide whether to update
      • lazySetShort

         abstract Unit lazySetShort(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:
        value - the value to set the element to
      • getAndSet

         final Short getAndSet(Short 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 Short getAndSet(Function1<Short, Short> 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 Short setAndGet(Function1<Short, Short> 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(Short new, Short 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 to
        expected - the expected value of the element
      • compareAndSet

         final Boolean compareAndSet(Short new, Function2<Short, Short, 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 to
        predicate - the binary predicate to apply to the old and new values to decide whether to update
      • lazySet

         final Unit lazySet(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:
        value - the value to set the element to