putIfAbsent

 

 

 

    public static HashSet<Long> getOrInitHashMapCacheValue(Long mId){
//        HashSet<Long> set = getHashMapRefCache().get(mId);
//        if(set == null){
//            set = getHashSet();
//            getHashMapRefCache().put(mId, set);
//        }
//        return set;
        HashSet<Long> set = getHashMapRefCache().get(mId);
        if(set == null){
            set = getHashSet();
            HashSet<Long> ret = getHashMapRefCache().putIfAbsent(mId, set);
            if(ret!=null){
                set = ret;
            }
        }
        return set;
    }

 

posted @ 2017-12-25 15:07  搜索技术  阅读(721)  评论(0编辑  收藏  举报