Class MutableInteger

    • Constructor Detail

      • MutableInteger

        public MutableInteger()
        Constructs a new MutableInteger
      • MutableInteger

        public MutableInteger​(int newValue)
        Constructs a new MutableInteger and stores the specified value.
        Parameters:
        newValue - the initial value
    • Method Detail

      • set

        public void set​(int newValue)
        Sets the value of the stored int
        Parameters:
        newValue - the new value to store
      • get

        public int get()
        Gets the value of the stored int
        Returns:
        the stored int
      • increment

        public void increment()
        Increments by 1 the stored value
      • incrementAndGet

        public int incrementAndGet()
        Increments by 1 the stored value and gets the new value
        Returns:
        the stored value, after it is incremented
      • getAndIncrement

        public int getAndIncrement()
        Increments by 1 the stored value and gets the previous stored value
        Returns:
        the store valued prior to the increment
      • decrement

        public void decrement()
        Decrements by 1 the stored value
      • decrementAndGet

        public int decrementAndGet()
        Decrements by 1 the stored value and gets the new value
        Returns:
        the stored value, after it is decremented
      • getAndDecrement

        public int getAndDecrement()
        Decrements by 1 the stored value and gets the previous stored value
        Returns:
        the store valued prior to the increment
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getValue

        public Integer getValue()
        Description copied from interface: Mutable
        Gets the value of this mutable.
        Specified by:
        getValue in interface Mutable<Integer>
        Returns:
        the store value
      • setValue

        public void setValue​(Integer newValue)
        Description copied from interface: Mutable
        Sets the value of this mutable
        Specified by:
        setValue in interface Mutable<Integer>
        Parameters:
        newValue - the new value to store
      • intValue

        public int intValue()
        Specified by:
        intValue in class Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class Number
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class Number