Class ThreadSafeSimpleCounter

    • Constructor Detail

      • ThreadSafeSimpleCounter

        public ThreadSafeSimpleCounter()
    • Method Detail

      • inc

        public void inc()
        Increment the current count by 1.
        Specified by:
        inc in interface Counter
      • inc

        public void inc​(long n)
        Increment the current count by the given value.
        Specified by:
        inc in interface Counter
        Parameters:
        n - value to increment the current count by
      • dec

        public void dec()
        Decrement the current count by 1.
        Specified by:
        dec in interface Counter
      • dec

        public void dec​(long n)
        Decrement the current count by the given value.
        Specified by:
        dec in interface Counter
        Parameters:
        n - value to decrement the current count by
      • getCount

        public long getCount()
        Returns the current count.
        Specified by:
        getCount in interface Counter
        Returns:
        current count