请帮助我在这里观察到的魔法:
Map<String, RenditionMeta> map = cache.asMap();
System.out.println("Before iterating: " + map.containsKey(objectId));
for(String s : map.keySet()) {
if(s.equals(objectId)) {
System.out.println(s + " equals " + objectId + ":" + s.equals(objectId) + "-" + map.containsKey(objectId));
System.out.println(objectId.hashCode());
System.out.println(s.hashCode());
}
}
输出:
Before iterating: false
09009e5d805f6b0b equals 09009e5d805f6b0b:true-false
1453886923
1453886923
有人可以解释&#34; true-false&#34;可能在上面吗?
缓存定义为
this.cache = CacheBuilder.newBuilder()
.concurrencyLevel(4)
.weakKeys()
.maximumSize(10000)
.expireAfterWrite(10, TimeUnit.MINUTES)
.build();