I read the JDK source code about ConcurrentHashMap.
But the following code confused me:
public boolean isEmpty() { final Segment<K,V>[] segments = this.segments; ... }
My question is:
"this.segments" is declared:
final Segment<K,V>[] segments;
So, here, at the beginning of a method declared as a reference to the same type, point to the same memory.
Why did the author write it like this? Why didn't they use this.segments directly? Is there any reason?
java
HUA Di 31 Oct. '12 at 10:29 2012-10-31 10:29
source share