public final class MoreAtomics extends Object
Modifier and Type | Method and Description |
---|---|
static long |
setMaxAndGet(long value,
AtomicLong atomicValue)
Update atomic variable if provided value is greater than value stored in atomic variable.
|
static long |
setMinAndGet(long value,
AtomicLong atomicValue)
Update atomic variable if provided value is less than value stored in atomic variable.
|
public static long setMaxAndGet(long value, AtomicLong atomicValue)
value
- A value to check against atomic valueatomicValue
- Atomic variable that will keep a maximum of two valuesatomicValue
public static long setMinAndGet(long value, AtomicLong atomicValue)
value
- A value to check against atomic valueatomicValue
- Atomic variable that will keep a minimum of two valuesatomicValue