public class Counter extends Object implements ICounter
| Constructor and Description |
|---|
Counter()
Default Constructor
|
Counter(long initialValue)
Constructor with initial value
|
| Modifier and Type | Method and Description |
|---|---|
long |
decrement()
Decrement the counter by 1
|
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
|
public Counter()
public Counter(long initialValue)
initialValue - initial valuepublic long increment()
ICounterpublic long decrement()
ICounterpublic long getAndSet(long newValue)
ICounterpublic long getValue()
ICounterpublic long increment(long amount)
ICounterCopyright © 2016–2021 Philip Helger. All rights reserved.