Discuss / Java / 练习题

练习题

Topic source

IM卓荣

#1 Created at ... [Delete] [Delete and Lock User]

int getScore(String name) {

// 先在Map中查找:

Integer score = this.cache.get(name);

if (score == null) {

// TODO:

score=findInList(name);

if(score!=null) this.cache.put(name, score);

}

return score == null ? -1 : score.intValue();

}

你好Aaron_y

#2 Created at ... [Delete] [Delete and Lock User]

赞一个!

后面为什么要在!=null 中put呢?已经返回score了啊


  • 1

Reply