AtomicInteger
class has 2 methods, get()
and intValue()
with following definitions.
intValue()
definition :
/**
* Returns the value of this {@code AtomicInteger} as an {@code int}.
*/
public int intValue() {
return get();
}
get()
definition:
/**
* Gets the current value.
*
* @return the current value
*/
public final int get() {
return value;
}
Is there any advantage of having a non final method intValue()? For all practical purposes, we can use get method if I am not wrong. Please explain if there is any advantage for such practice.