Package io.vertx.rxjava3.core.shareddata

## Class Counter

- java.lang.Object
- - io.vertx.rxjava3.core.shareddata.Counter

-     public class Counter
      extends Object

  An asynchronous counter that can be used to across the cluster to maintain a consistent count.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<Counter>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Counter​(Counter delegate)` |
    `Counter​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Single<Long>` | `addAndGet​(long value)` | Add the value to the counter atomically and return the new count
    `Single<Boolean>` | `compareAndSet​(long expected, long value)` | Set the counter to the specified value only if the current value is the expectec value.
    `Single<Long>` | `decrementAndGet()` | Decrement the counter atomically and return the new count
    `boolean` | `equals​(Object o)` |
    `Single<Long>` | `get()` | Get the current value of the counter
    `Single<Long>` | `getAndAdd​(long value)` | Add the value to the counter atomically and return the value before the add
    `Single<Long>` | `getAndIncrement()` | Increment the counter atomically and return the value before the increment.
    `Counter` | `getDelegate()` |
    `int` | `hashCode()` |
    `Single<Long>` | `incrementAndGet()` | Increment the counter atomically and return the new count
    `static Counter` | `newInstance​(Counter arg)` |
    `Single<Long>` | `rxAddAndGet​(long value)` | Add the value to the counter atomically and return the new count
    `Single<Boolean>` | `rxCompareAndSet​(long expected, long value)` | Set the counter to the specified value only if the current value is the expectec value.
    `Single<Long>` | `rxDecrementAndGet()` | Decrement the counter atomically and return the new count
    `Single<Long>` | `rxGet()` | Get the current value of the counter
    `Single<Long>` | `rxGetAndAdd​(long value)` | Add the value to the counter atomically and return the value before the add
    `Single<Long>` | `rxGetAndIncrement()` | Increment the counter atomically and return the value before the increment.
    `Single<Long>` | `rxIncrementAndGet()` | Increment the counter atomically and return the new count
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Counter> __TYPE_ARG

  - ### Constructor Detail

    - #### Counter

          public Counter​(Counter delegate)

    - #### Counter

          public Counter​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public Counter getDelegate()

    - #### get

          public Single<Long> get()

      Get the current value of the counter
      Returns:
        a future notified with the value

    - #### rxGet

          public Single<Long> rxGet()

      Get the current value of the counter
      Returns:
        a future notified with the value

    - #### incrementAndGet

          public Single<Long> incrementAndGet()

      Increment the counter atomically and return the new count
      Returns:
        a future notified with the value

    - #### rxIncrementAndGet

          public Single<Long> rxIncrementAndGet()

      Increment the counter atomically and return the new count
      Returns:
        a future notified with the value

    - #### getAndIncrement

          public Single<Long> getAndIncrement()

      Increment the counter atomically and return the value before the increment.
      Returns:
        a future notified with the value

    - #### rxGetAndIncrement

          public Single<Long> rxGetAndIncrement()

      Increment the counter atomically and return the value before the increment.
      Returns:
        a future notified with the value

    - #### decrementAndGet

          public Single<Long> decrementAndGet()

      Decrement the counter atomically and return the new count
      Returns:
        a future notified with the value

    - #### rxDecrementAndGet

          public Single<Long> rxDecrementAndGet()

      Decrement the counter atomically and return the new count
      Returns:
        a future notified with the value

    - #### addAndGet

          public Single<Long> addAndGet​(long value)

      Add the value to the counter atomically and return the new count
      Parameters:
        `value` - the value to add
      Returns:
        a future notified with the value

    - #### rxAddAndGet

          public Single<Long> rxAddAndGet​(long value)

      Add the value to the counter atomically and return the new count
      Parameters:
        `value` - the value to add
      Returns:
        a future notified with the value

    - #### getAndAdd

          public Single<Long> getAndAdd​(long value)

      Add the value to the counter atomically and return the value before the add
      Parameters:
        `value` - the value to add
      Returns:
        a future notified with the value

    - #### rxGetAndAdd

          public Single<Long> rxGetAndAdd​(long value)

      Add the value to the counter atomically and return the value before the add
      Parameters:
        `value` - the value to add
      Returns:
        a future notified with the value

    - #### compareAndSet

          public Single<Boolean> compareAndSet​(long expected,
                                               long value)

      Set the counter to the specified value only if the current value is the expectec value. This happens atomically.
      Parameters:
        `expected` - the expected value
        `value` - the new value
      Returns:
        a future notified with `true` on success

    - #### rxCompareAndSet

          public Single<Boolean> rxCompareAndSet​(long expected,
                                                 long value)

      Set the counter to the specified value only if the current value is the expectec value. This happens atomically.
      Parameters:
        `expected` - the expected value
        `value` - the new value
      Returns:
        a future notified with `true` on success

    - #### newInstance

          public static Counter newInstance​(Counter arg)