Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.ConcurrentHashMap;

public class Main {
    private static ThreadLocal<ConcurrentHashMap<String, Object>> _map = new ThreadLocal<ConcurrentHashMap<String, Object>>();

    public static int getSetCount(String key) {
        return (Integer) (map().get(countKey(key)));
    }

    private static ConcurrentHashMap<String, Object> map() {
        if (_map.get() == null)
            _map.set(new ConcurrentHashMap<String, Object>());
        return _map.get();
    }

    private static String countKey(String key) {
        return String.format("__%s:count__", key);
    }
}