Discuss / Java / 打卡

打卡

Topic source

Allen李康

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

    /**

     * 根据name查找score,找到返回score,未找到返回-1

     */

    int getScore(String name) {

        // 先在Map中查找:

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

        if (score == null) {

            // TODO:

            if((score = findInList(name)) != null){

                this.cache.put(name,score);

           }

        }

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

    }


  • 1

Reply