public int getScore(String name) {
Integer score;
score=this.cache.get(name);
if(score==null) {
score=this.findInList(name);
this.cache.put(name, score);
}
return score;
public int findInList(String name) {
int score=-1;
for(var stu:this.list) {
if(name.equals(stu.getName())) {
score=stu.getScore();
Sign in to make a reply
净净一隅
public int getScore(String name) {
Integer score;
score=this.cache.get(name);
if(score==null) {
score=this.findInList(name);
this.cache.put(name, score);
}
return score;
}
public int findInList(String name) {
int score=-1;
for(var stu:this.list) {
if(name.equals(stu.getName())) {
score=stu.getScore();
}
}
return score;
}