Interface Counter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long decrement()
      Decrement the counter by 1
      long decrement​(long amount)
      Decrement the counter by given amount
      long getAndSet​(long newValue)
      Returns the value of the counter and sets it to the new value
      long getValue()
      Gets current value of the counter
      long increment()
      Increment the counter by 1
      long increment​(long amount)
      Increment the counter by given amount
      void setValue​(long newValue)
      Sets the value of the counter to the supplied value
    • Method Detail

      • increment

        long increment()
        Increment the counter by 1
        Returns:
        the value after incrementing
      • decrement

        long decrement()
        Decrement the counter by 1
        Returns:
        the value after decrementing
      • getAndSet

        long getAndSet​(long newValue)
        Returns the value of the counter and sets it to the new value
        Parameters:
        newValue -
        Returns:
        Returns the old value
      • getValue

        long getValue()
        Gets current value of the counter
        Returns:
        current value of the counter
      • increment

        long increment​(long amount)
        Increment the counter by given amount
        Parameters:
        amount -
        Returns:
        the value of the counter after incrementing
      • decrement

        long decrement​(long amount)
        Decrement the counter by given amount
        Parameters:
        amount -
        Returns:
        the value of the counter after decrementing
      • setValue

        void setValue​(long newValue)
        Sets the value of the counter to the supplied value
        Parameters:
        newValue -