public class Counter extends Object
This is useful when an object on the heap is required to track counting.
Modifier and Type | Method and Description |
---|---|
void |
decrement()
Decreases the counter by one.
|
int |
getCount()
The count, as per current state.
|
void |
increment()
Increases the counter by one.
|
void |
incrementBy(int value)
Increases the counter by a specific value.
|
int |
incrementReturn()
Increases the counter by one, returning the previous value.
|
public void increment()
public int incrementReturn()
public void incrementBy(int value)
value
- the value to increase the counter by.public void decrement()
public int getCount()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.