I am reading the source code of tomcat, and I notice something strange in org.apache.catalina.webresources.CachedResource:
@Override
public long getLastModified() {
Long cachedLastModified = this.cachedLastModified;
if (cachedLastModified == null) {
cachedLastModified =
Long.valueOf(webResource.getLastModified());
this.cachedLastModified = cachedLastModified;
}
return cachedLastModified.longValue();
}
What if I replace it with:
@Override
public long getLastModified() {
if (this.cachedLastModified == null) {
this.cachedLastModified =
Long.valueOf(webResource.getLastModified());
}
return this.cachedLastModified.longValue();
}
There are several functions like this. I don't understand it is written like this.