chapter5 java last value caching