Interface IntWrapper

All Superinterfaces:
Numeric, PrimitiveWrapper<Integer>
All Known Implementing Classes:
IntWrapper.AtomicIntWrapper, IntWrapper.PrimitiveIntWrapper

public interface IntWrapper extends PrimitiveWrapper<Integer>, Numeric
  • Method Details

    • create

      static IntWrapper create(int value)
      Creates new simple int wrapper.
      Parameters:
      value - initial value of int wrapper
      Returns:
      created int wrapper
    • create

      static IntWrapper create()
      Creates new simple int wrapper with initial value set to 0.
      Returns:
      created int wrapper
    • createAtomic

      static IntWrapper createAtomic(int value)
      Creates new atomic int wrapper.
      Parameters:
      value - initial value of int wrapper
      Returns:
      created int wrapper
    • createAtomic

      static IntWrapper createAtomic()
      Creates new atomic int wrapper with initial value set to 0.
      Returns:
      created int wrapper
    • getPrimitiveClass

      default Class<Integer> getPrimitiveClass()
      Description copied from interface: PrimitiveWrapper
      Returns the primitive class wrapped by this one.
      Specified by:
      getPrimitiveClass in interface PrimitiveWrapper<Integer>
      Returns:
      wrapped primitive class
    • getWrapperClass

      default Class<Integer> getWrapperClass()
      Description copied from interface: PrimitiveWrapper
      Returns the java.lang primitive wrapper class corresponding to the one wrapped.
      Specified by:
      getWrapperClass in interface PrimitiveWrapper<Integer>
      Returns:
      related java.lang primitive wrapper
    • get

      int get()
      Gets the value.
      Returns:
      value
    • set

      void set(int value)
      Sets the value.
      Parameters:
      value - value to be set
    • getAndSet

      int getAndSet(int newValue)
      Sets the value to the one given returning the previous one.
      Parameters:
      newValue - value to be set
      Returns:
      previous value
    • getAndIncrement

      int getAndIncrement()
      Gets the value after what it gets incremented.
      Returns:
      value before increment
    • incrementAndGet

      int incrementAndGet()
      Increments the value after what it is returned.
      Returns:
      value after increment
    • getAndDecrement

      int getAndDecrement()
      Gets the value after what it gets decremented.
      Returns:
      value before decrement
    • decrementAndGet

      int decrementAndGet()
      Decrements the value after what it is returned.
      Returns:
      value after decrement
    • getAndAdd

      int getAndAdd(int delta)
      Gets the value after what delta is added to it.
      Parameters:
      delta - the value which should be added to the current value
      Returns:
      value before addition
    • addAndGet

      int addAndGet(int delta)
      Adds the delta to the value after what it is returned.
      Parameters:
      delta - the value which should be added to the current value
      Returns:
      value after addition
    • getAndUpdate

      int getAndUpdate(@NonNull @NonNull IntUnaryOperator updateFunction)
      Updates the current value using the specified function after what the new value is returned.
      Parameters:
      updateFunction - function to be used for updating the value
      Returns:
      value before update
    • updateAndGet

      int updateAndGet(@NonNull @NonNull IntUnaryOperator updateFunction)
      Gets the value after what it gets updated using the specified function.
      Parameters:
      updateFunction - function to be used for updating the value
      Returns:
      value after update
    • getAndAccumulate

      int getAndAccumulate(int updateValue, @NonNull @NonNull IntBinaryOperator accumulatorFunction)
      Updates the current value using specified function and update value after what the new value is returned.
      Parameters:
      updateValue - update value (will be passed as the second function parameter)
      accumulatorFunction - function to be used for updating the value
      Returns:
      value before update
    • accumulateAndGet

      int accumulateAndGet(int updateValue, @NonNull @NonNull IntBinaryOperator accumulatorFunction)
      Gets the value after what it gets updated using the specified function and update value.
      Parameters:
      updateValue - update value (will be passed as the second function parameter)
      accumulatorFunction - function to be used for updating the value
      Returns:
      value after update